Merge pull request #189 from jonathandturner/roundtrip_yaml

Add yaml roundtrip test. Bump nu version
This commit is contained in:
Jonathan Turner 2019-07-18 06:06:38 +12:00 committed by GitHub
commit 53c6234aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 6 deletions

3
Cargo.lock generated
View File

@ -1631,7 +1631,7 @@ dependencies = [
[[package]] [[package]]
name = "nu" name = "nu"
version = "0.1.2" version = "0.1.3"
dependencies = [ dependencies = [
"adhoc_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "adhoc_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ansi_term 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1680,6 +1680,7 @@ dependencies = [
"reqwest 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"roxmltree 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "roxmltree 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustyline 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustyline 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "nu" name = "nu"
version = "0.1.2" version = "0.1.3"
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>"] authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>"]
description = "A shell for the GitHub era" description = "A shell for the GitHub era"
license = "MIT" license = "MIT"
@ -74,6 +74,7 @@ rawkey = "0.1.1"
crossterm = "0.9.6" crossterm = "0.9.6"
tempfile = "3.1.0" tempfile = "3.1.0"
image = "0.21.2" image = "0.21.2"
semver = "0.9.0"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6.1" pretty_assertions = "0.6.1"

View File

@ -13,13 +13,26 @@ fn can_convert_table_to_json_text_and_from_json_text_back_into_table() {
#[test] #[test]
fn can_convert_table_to_toml_text_and_from_toml_text_back_into_table() { fn can_convert_table_to_toml_text_and_from_toml_text_back_into_table() {
nu!(output, nu!(
output,
cwd("tests/fixtures/formats"), cwd("tests/fixtures/formats"),
"open cargo_sample.toml | to-toml | from-toml | get package.name | echo $it"); "open cargo_sample.toml | to-toml | from-toml | get package.name | echo $it"
);
assert_eq!(output, "nu"); assert_eq!(output, "nu");
} }
#[test]
fn can_convert_table_to_yaml_text_and_from_yaml_text_back_into_table() {
nu!(
output,
cwd("tests/fixtures/formats"),
"open appveyor.yml | to-yaml | from-yaml | get environment.global.PROJECT_NAME | echo $it"
);
assert_eq!(output, "nushell");
}
#[test] #[test]
fn can_sort_by_column() { fn can_sort_by_column() {
nu!(output, nu!(output,
@ -40,9 +53,11 @@ fn can_split_by_column() {
#[test] #[test]
fn can_filter_by_unit_size_comparison() { fn can_filter_by_unit_size_comparison() {
nu!(output, nu!(
output,
cwd("tests/fixtures/formats"), cwd("tests/fixtures/formats"),
"ls | where size > 1kb | get name | trim | echo $it"); "ls | where size > 1kb | get name | trim | echo $it"
);
assert_eq!(output, "cargo_sample.toml"); assert_eq!(output, "cargo_sample.toml");
} }

31
tests/fixtures/formats/appveyor.yml vendored Normal file
View File

@ -0,0 +1,31 @@
image: Visual Studio 2017
environment:
global:
PROJECT_NAME: nushell
RUST_BACKTRACE: 1
matrix:
- TARGET: x86_64-pc-windows-msvc
CHANNEL: nightly
BITS: 64
install:
- set PATH=C:\msys64\mingw%BITS%\bin;C:\msys64\usr\bin;%PATH%
- curl -sSf -o rustup-init.exe https://win.rustup.rs
# Install rust
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %CHANNEL%-%TARGET%
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
# Required for Racer autoconfiguration
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
build: false
test_script:
# compile #[cfg(not(test))] code
- cargo build --verbose
- cargo test --all --verbose
cache:
- target -> Cargo.lock
- C:\Users\appveyor\.cargo\registry -> Cargo.lock