mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:25:38 +02:00
Pick->Select rename. Integration tests changes. (#1725)
Pick->Select rename. Integration tests changes.
This commit is contained in:
committed by
GitHub
parent
c3efdf2689
commit
96e5fc05a3
@ -12,6 +12,6 @@ fn alias_args_work() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "[1,2]");
|
||||
assert_eq!(actual.out, "[1,2]");
|
||||
})
|
||||
}
|
||||
|
@ -25,6 +25,6 @@ fn adds_a_row_to_the_end() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "pollo loco");
|
||||
assert_eq!(actual.out, "pollo loco");
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ fn calculates_two_plus_two() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.contains("4.0"));
|
||||
assert!(actual.out.contains("4.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -21,7 +21,7 @@ fn calculates_two_to_the_power_six() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.contains("64.0"));
|
||||
assert!(actual.out.contains("64.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -33,7 +33,7 @@ fn calculates_three_multiplied_by_five() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.contains("15.0"));
|
||||
assert!(actual.out.contains("15.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -45,5 +45,5 @@ fn calculates_twenty_four_divided_by_two() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.contains("12.0"));
|
||||
assert!(actual.out.contains("12.0"));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::{Stub::EmptyFile, Stub::FileWithContent};
|
||||
use nu_test_support::nu;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
@ -14,7 +14,7 @@ fn filesystem_change_from_current_directory_using_relative_path() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), *dirs.test());
|
||||
assert_eq!(PathBuf::from(actual.out), *dirs.test());
|
||||
})
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ fn filesystem_change_from_current_directory_using_absolute_path() {
|
||||
dirs.formats()
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), dirs.formats());
|
||||
assert_eq!(PathBuf::from(actual.out), dirs.formats());
|
||||
})
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ fn filesystem_switch_back_to_previous_working_directory() {
|
||||
dirs.test()
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), dirs.test().join("odin"));
|
||||
assert_eq!(PathBuf::from(actual.out), dirs.test().join("odin"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -66,7 +66,10 @@ fn filesytem_change_from_current_directory_using_relative_path_and_dash() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), dirs.test().join("odin").join("-"));
|
||||
assert_eq!(
|
||||
PathBuf::from(actual.out),
|
||||
dirs.test().join("odin").join("-")
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
@ -81,7 +84,7 @@ fn filesystem_change_current_directory_to_parent_directory() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), *dirs.root());
|
||||
assert_eq!(PathBuf::from(actual.out), *dirs.root());
|
||||
})
|
||||
}
|
||||
|
||||
@ -98,7 +101,7 @@ fn filesystem_change_current_directory_to_two_parents_up_using_multiple_dots() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), *dirs.test());
|
||||
assert_eq!(PathBuf::from(actual.out), *dirs.test());
|
||||
})
|
||||
}
|
||||
|
||||
@ -118,7 +121,7 @@ fn filesystem_change_current_directory_to_parent_directory_after_delete_cwd() {
|
||||
dirs.test()
|
||||
);
|
||||
|
||||
let actual = actual.split(',').nth(1).unwrap();
|
||||
let actual = actual.out.split(',').nth(1).unwrap();
|
||||
|
||||
assert_eq!(PathBuf::from(actual), *dirs.test().join("foo"));
|
||||
})
|
||||
@ -135,7 +138,7 @@ fn filesystem_change_to_home_directory() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(Some(PathBuf::from(actual)), dirs::home_dir());
|
||||
assert_eq!(Some(PathBuf::from(actual.out)), dirs::home_dir());
|
||||
})
|
||||
}
|
||||
|
||||
@ -153,7 +156,7 @@ fn filesystem_change_to_a_directory_containing_spaces() {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
PathBuf::from(actual),
|
||||
PathBuf::from(actual.out),
|
||||
dirs.test().join("robalino turner katz")
|
||||
);
|
||||
})
|
||||
@ -164,34 +167,42 @@ fn filesystem_not_a_directory() {
|
||||
Playground::setup("cd_test_10", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("ferris_did_it.txt")]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"cd ferris_did_it.txt"
|
||||
);
|
||||
|
||||
assert!(actual.contains("ferris_did_it.txt"), "actual={:?}", actual);
|
||||
assert!(actual.contains("is not a directory"), "actual={:?}", actual);
|
||||
assert!(
|
||||
actual.err.contains("ferris_did_it.txt"),
|
||||
"actual={:?}",
|
||||
actual.err
|
||||
);
|
||||
assert!(
|
||||
actual.err.contains("is not a directory"),
|
||||
"actual={:?}",
|
||||
actual.err
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filesystem_directory_not_found() {
|
||||
Playground::setup("cd_test_11", |dirs, _| {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"cd dir_that_does_not_exist"
|
||||
|
||||
);
|
||||
|
||||
assert!(
|
||||
actual.contains("dir_that_does_not_exist"),
|
||||
actual.err.contains("dir_that_does_not_exist"),
|
||||
"actual={:?}",
|
||||
actual
|
||||
actual.err
|
||||
);
|
||||
assert!(
|
||||
actual.contains("directory not found"),
|
||||
actual.err.contains("directory not found"),
|
||||
"actual={:?}",
|
||||
actual
|
||||
actual.err
|
||||
);
|
||||
})
|
||||
}
|
||||
@ -211,7 +222,7 @@ fn filesystem_change_directory_to_symlink_relative() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), dirs.test().join("foo"));
|
||||
assert_eq!(PathBuf::from(actual.out), dirs.test().join("foo"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -242,7 +253,7 @@ fn valuesystem_change_from_current_path_using_relative_path() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), PathBuf::from("/bin"));
|
||||
assert_eq!(PathBuf::from(actual.out), PathBuf::from("/bin"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -276,7 +287,7 @@ fn valuesystem_change_from_current_path_using_absolute_path() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), PathBuf::from("/dependencies"));
|
||||
assert_eq!(PathBuf::from(actual.out), PathBuf::from("/dependencies"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -312,7 +323,7 @@ fn valuesystem_switch_back_to_previous_working_path() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), PathBuf::from("/dependencies"));
|
||||
assert_eq!(PathBuf::from(actual.out), PathBuf::from("/dependencies"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -346,7 +357,7 @@ fn valuesystem_change_from_current_path_using_relative_path_and_dash() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), PathBuf::from("/package/-"));
|
||||
assert_eq!(PathBuf::from(actual.out), PathBuf::from("/package/-"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -373,7 +384,7 @@ fn valuesystem_change_current_path_to_parent_path() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), PathBuf::from("/package"));
|
||||
assert_eq!(PathBuf::from(actual.out), PathBuf::from("/package"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -398,14 +409,17 @@ fn valuesystem_change_to_a_path_containing_spaces() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(PathBuf::from(actual), PathBuf::from("/").join("pa que te"));
|
||||
assert_eq!(
|
||||
PathBuf::from(actual.out),
|
||||
PathBuf::from("/").join("pa que te")
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn valuesystem_path_not_found() {
|
||||
Playground::setup("cd_test_19", |dirs, _| {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.formats(),
|
||||
r#"
|
||||
enter cargo_sample.toml
|
||||
@ -414,7 +428,7 @@ fn valuesystem_path_not_found() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.contains("Can not change to path inside"));
|
||||
assert!(actual.contains("No such path exists"));
|
||||
assert!(actual.err.contains("Can not change to path inside"));
|
||||
assert!(actual.err.contains("No such path exists"));
|
||||
})
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ fn discards_rows_where_given_column_is_empty() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
@ -47,6 +47,6 @@ fn discards_empty_rows_by_default() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::{files_exist_at, AbsoluteFile, Stub::EmptyFile};
|
||||
use nu_test_support::nu;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error};
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
@ -34,13 +34,13 @@ fn copies_the_file_inside_directory_if_path_to_copy_is_directory() {
|
||||
#[test]
|
||||
fn error_if_attempting_to_copy_a_directory_to_another_directory() {
|
||||
Playground::setup("cp_test_3", |dirs, _| {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.formats(),
|
||||
"cp ../formats {}", dirs.test()
|
||||
);
|
||||
|
||||
assert!(actual.contains("../formats"));
|
||||
assert!(actual.contains("resolves to a directory (not copied)"));
|
||||
assert!(actual.err.contains("../formats"));
|
||||
assert!(actual.err.contains("resolves to a directory (not copied)"));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,6 @@ fn adds_row_data_if_column_missing() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
});
|
||||
}
|
||||
|
@ -7,5 +7,5 @@ fn drop_rows() {
|
||||
r#"echo '[{"foo": 3}, {"foo": 8}, {"foo": 4}]' | from json | drop 2 | get foo | sum | echo $it"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
}
|
||||
|
@ -9,5 +9,5 @@ fn each_works_separately() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "[11,12,13]");
|
||||
assert_eq!(actual.out, "[11,12,13]");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::{files_exist_at, Stub::EmptyFile};
|
||||
use nu_test_support::nu;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error};
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
@ -75,12 +75,12 @@ fn knows_the_filesystems_entered() {
|
||||
#[test]
|
||||
fn errors_if_file_not_found() {
|
||||
Playground::setup("enter_test_2", |dirs, _| {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"enter i_dont_exist.csv"
|
||||
);
|
||||
|
||||
assert!(actual.contains("File could not be opened"));
|
||||
assert!(actual.contains("file not found"));
|
||||
assert!(actual.err.contains("File could not be opened"));
|
||||
assert!(actual.err.contains("file not found"));
|
||||
})
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ fn gets_first_rows_by_amount() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ fn gets_all_rows_if_amount_higher_than_all_rows() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
||||
@ -65,6 +65,6 @@ fn gets_first_row_when_no_amount_given() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
})
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ fn creates_the_resulting_string_from_the_given_fields() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "nu has license ISC");
|
||||
assert_eq!(actual.out, "nu has license ISC");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -26,5 +26,5 @@ fn given_fields_can_be_column_paths() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "nu is a new type of shell");
|
||||
assert_eq!(actual.out, "nu is a new type of shell");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::Stub::FileWithContent;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error, pipeline};
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn fetches_a_row() {
|
||||
@ -21,7 +21,7 @@ fn fetches_a_row() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "zion");
|
||||
assert_eq!(actual.out, "zion");
|
||||
})
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ fn fetches_by_index() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "Andrés N. Robalino <andres@androbtech.com>");
|
||||
assert_eq!(actual.out, "Andrés N. Robalino <andres@androbtech.com>");
|
||||
})
|
||||
}
|
||||
#[test]
|
||||
@ -71,7 +71,7 @@ fn fetches_by_column_path() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "nu");
|
||||
assert_eq!(actual.out, "nu");
|
||||
})
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ fn column_paths_are_either_double_quoted_or_regular_unquoted_words_separated_by_
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ fn fetches_more_than_one_column_path() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "Jonathan Turner");
|
||||
assert_eq!(actual.out, "Jonathan Turner");
|
||||
})
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ fn errors_fetching_by_column_not_present() {
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open sample.toml
|
||||
@ -155,16 +155,16 @@ fn errors_fetching_by_column_not_present() {
|
||||
));
|
||||
|
||||
assert!(
|
||||
actual.contains("Unknown column"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("Unknown column"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("There isn't a column named 'taco'"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("There isn't a column named 'taco'"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("Perhaps you meant 'taconushell'?"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("Perhaps you meant 'taconushell'?"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
)
|
||||
})
|
||||
}
|
||||
@ -180,7 +180,7 @@ fn errors_fetching_by_column_using_a_number() {
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open sample.toml
|
||||
@ -189,16 +189,18 @@ fn errors_fetching_by_column_using_a_number() {
|
||||
));
|
||||
|
||||
assert!(
|
||||
actual.contains("No rows available"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("No rows available"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("A row at '0' can't be indexed."),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("A row at '0' can't be indexed."),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("Appears to contain columns. Columns available: 0"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual
|
||||
.err
|
||||
.contains("Appears to contain columns. Columns available: 0"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
)
|
||||
})
|
||||
}
|
||||
@ -213,7 +215,7 @@ fn errors_fetching_by_index_out_of_bounds() {
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open sample.toml
|
||||
@ -222,16 +224,16 @@ fn errors_fetching_by_index_out_of_bounds() {
|
||||
));
|
||||
|
||||
assert!(
|
||||
actual.contains("Row not found"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("Row not found"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("There isn't a row indexed at 3"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("There isn't a row indexed at 3"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("The table only has 3 rows (0 to 2)"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("The table only has 3 rows (0 to 2)"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
)
|
||||
})
|
||||
}
|
||||
@ -243,5 +245,5 @@ fn quoted_column_access() {
|
||||
r#"echo '[{"foo bar": {"baz": 4}}]' | from json | get "foo bar".baz | echo $it"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error, pipeline};
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn groups() {
|
||||
@ -26,7 +26,7 @@ fn groups() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
})
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ fn errors_if_given_unknown_column_name_is_missing() {
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.csv
|
||||
@ -51,6 +51,6 @@ fn errors_if_given_unknown_column_name_is_missing() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.contains("Unknown column"));
|
||||
assert!(actual.err.contains("Unknown column"));
|
||||
})
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ fn headers_uses_first_row_as_header() {
|
||||
| from json"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "r1c0r2c0")
|
||||
assert_eq!(actual.out, "r1c0r2c0")
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -27,5 +27,5 @@ fn headers_adds_missing_column_name() {
|
||||
| from json"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "r1c1r2c1")
|
||||
assert_eq!(actual.out, "r1c1r2c1")
|
||||
}
|
||||
|
@ -26,7 +26,10 @@ fn summarizes() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "**************************************************");
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"**************************************************"
|
||||
);
|
||||
// 50%
|
||||
})
|
||||
}
|
||||
@ -55,7 +58,7 @@ fn help() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(help_short, help_command);
|
||||
assert_eq!(help_long, help_command);
|
||||
assert_eq!(help_short.out, help_command.out);
|
||||
assert_eq!(help_long.out, help_command.out);
|
||||
})
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ fn insert_plugin() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ fn adds_value_provided_if_column_is_empty() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ fn adds_value_provided_for_columns_that_are_empty() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "8");
|
||||
assert_eq!(actual.out, "8");
|
||||
})
|
||||
}
|
||||
|
||||
@ -91,6 +91,6 @@ fn value_emptiness_check() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ fn rows() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
@ -46,6 +46,6 @@ fn condition_is_met() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "8");
|
||||
assert_eq!(actual.out, "8");
|
||||
})
|
||||
}
|
||||
|
@ -46,6 +46,6 @@ fn condition_is_met() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ fn gets_the_last_row() {
|
||||
"ls | sort-by name | last 1 | get name | trim | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "utf16.ini");
|
||||
assert_eq!(actual.out, "utf16.ini");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -32,7 +32,7 @@ fn gets_last_rows_by_amount() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -51,6 +51,6 @@ fn gets_last_row_when_no_amount_given() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
})
|
||||
}
|
||||
|
@ -17,5 +17,5 @@ fn lines() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "rustyline");
|
||||
assert_eq!(actual.out, "rustyline");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::Stub::EmptyFile;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error, pipeline};
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn lists_regular_files() {
|
||||
@ -20,7 +20,7 @@ fn lists_regular_files() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ fn lists_regular_files_using_asterisk_wildcard() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ fn lists_regular_files_using_question_mark_wildcard() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ fn lists_all_files_in_directories_from_stream() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ fn does_not_fail_if_glob_matches_empty_directory() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "0");
|
||||
assert_eq!(actual.out, "0");
|
||||
})
|
||||
}
|
||||
|
||||
@ -123,12 +123,12 @@ fn fails_when_glob_doesnt_match() {
|
||||
Playground::setup("ls_test_5", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("root1.txt"), EmptyFile("root2.txt")]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"ls root3*"
|
||||
);
|
||||
|
||||
assert!(actual.contains("no matches found"));
|
||||
assert!(actual.err.contains("no matches found"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -151,6 +151,6 @@ fn list_files_from_two_parents_up_using_multiple_dots() {
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "5");
|
||||
assert_eq!(actual.out, "5");
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ fn one_arg() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -21,7 +21,7 @@ fn add() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -33,7 +33,7 @@ fn add_compount() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "5");
|
||||
assert_eq!(actual.out, "5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -45,7 +45,7 @@ fn precedence_of_operators() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "5");
|
||||
assert_eq!(actual.out, "5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -57,7 +57,7 @@ fn precedence_of_operators2() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "6");
|
||||
assert_eq!(actual.out, "6");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -69,7 +69,7 @@ fn division_of_ints() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -81,7 +81,7 @@ fn division_of_ints2() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "0.25");
|
||||
assert_eq!(actual.out, "0.25");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -93,7 +93,7 @@ fn parens_precedence() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "12");
|
||||
assert_eq!(actual.out, "12");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -105,7 +105,7 @@ fn compound_comparison() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "true");
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -117,7 +117,7 @@ fn compound_comparison2() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "true");
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -129,7 +129,7 @@ fn compound_where() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, r#"{"a":2,"b":1}"#);
|
||||
assert_eq!(actual.out, r#"{"a":2,"b":1}"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -141,5 +141,5 @@ fn compound_where_paren() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, r#"[{"a":2,"b":1},{"a":2,"b":2}]"#);
|
||||
assert_eq!(actual.out, r#"[{"a":2,"b":1},{"a":2,"b":2}]"#);
|
||||
}
|
||||
|
@ -38,6 +38,6 @@ fn row() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
})
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ mod mkdir;
|
||||
mod mv;
|
||||
mod open;
|
||||
mod parse;
|
||||
mod pick;
|
||||
mod prepend;
|
||||
mod range;
|
||||
mod rename;
|
||||
mod reverse;
|
||||
mod rm;
|
||||
mod save;
|
||||
mod select;
|
||||
mod semicolon;
|
||||
mod skip_until;
|
||||
mod sort_by;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::{files_exist_at, Stub::EmptyFile};
|
||||
use nu_test_support::nu;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error};
|
||||
|
||||
#[test]
|
||||
fn moves_a_file() {
|
||||
@ -223,11 +223,11 @@ fn moves_a_directory_with_files() {
|
||||
fn errors_if_source_doesnt_exist() {
|
||||
Playground::setup("mv_test_10", |dirs, sandbox| {
|
||||
sandbox.mkdir("test_folder");
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.root(),
|
||||
"mv non-existing-file test_folder/"
|
||||
);
|
||||
assert!(actual.contains("Invalid file or pattern"));
|
||||
assert!(actual.err.contains("Invalid file or pattern"));
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ fn selects_a_row() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "arepas.txt");
|
||||
assert_eq!(actual.out, "arepas.txt");
|
||||
});
|
||||
}
|
||||
|
||||
@ -34,6 +34,6 @@ fn selects_many_rows() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
});
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error, pipeline};
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn parses_csv() {
|
||||
@ -25,7 +25,7 @@ fn parses_csv() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "Ecuador");
|
||||
assert_eq!(actual.out, "Ecuador");
|
||||
})
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ fn parses_bson() {
|
||||
"open sample.bson | get root | nth 0 | get b | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "hello");
|
||||
assert_eq!(actual.out, "hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -78,7 +78,7 @@ fn parses_more_bson_complexity() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "function");
|
||||
assert_eq!(actual.out, "function");
|
||||
}
|
||||
|
||||
// sample.db has the following format:
|
||||
@ -143,7 +143,7 @@ fn parses_sqlite() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "hello");
|
||||
assert_eq!(actual.out, "hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -153,7 +153,7 @@ fn parses_toml() {
|
||||
"open cargo_sample.toml | get package.edition | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "2018");
|
||||
assert_eq!(actual.out, "2018");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -168,7 +168,7 @@ fn parses_tsv() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "SPAIN")
|
||||
assert_eq!(actual.out, "SPAIN")
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -182,7 +182,7 @@ fn parses_json() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "markup")
|
||||
assert_eq!(actual.out, "markup")
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -193,7 +193,7 @@ fn parses_xml() {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
actual,
|
||||
actual.out,
|
||||
"http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"
|
||||
)
|
||||
}
|
||||
@ -205,7 +205,7 @@ fn parses_ini() {
|
||||
"open sample.ini | get SectionOne.integer | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "1234")
|
||||
assert_eq!(actual.out, "1234")
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -215,16 +215,16 @@ fn parses_utf16_ini() {
|
||||
"open utf16.ini | get '.ShellClassInfo' | get IconIndex | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "-236")
|
||||
assert_eq!(actual.out, "-236")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_if_file_not_found() {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open i_dont_exist.txt"
|
||||
);
|
||||
|
||||
assert!(actual.contains("File could not be opened"));
|
||||
assert!(actual.contains("file not found"));
|
||||
assert!(actual.err.contains("File could not be opened"));
|
||||
assert!(actual.err.contains("file not found"));
|
||||
}
|
||||
|
@ -25,6 +25,6 @@ fn extracts_fields_from_the_given_the_pattern() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "JonathanParsed");
|
||||
assert_eq!(actual.out, "JonathanParsed");
|
||||
})
|
||||
}
|
||||
|
@ -25,6 +25,6 @@ fn adds_a_row_to_the_beginning() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "pollo loco");
|
||||
assert_eq!(actual.out, "pollo loco");
|
||||
})
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ fn selects_a_row() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "notes.txt");
|
||||
assert_eq!(actual.out, "notes.txt");
|
||||
});
|
||||
}
|
||||
|
||||
@ -42,6 +42,6 @@ fn selects_some_rows() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error, pipeline};
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn changes_the_column_name() {
|
||||
@ -28,7 +28,7 @@ fn changes_the_column_name() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ fn keeps_remaining_original_names_given_less_new_names_than_total_original_names
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
})
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ fn errors_if_no_columns_present() {
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_cuatro_mosqueteros.txt
|
||||
@ -86,12 +86,12 @@ fn errors_if_no_columns_present() {
|
||||
));
|
||||
|
||||
assert!(
|
||||
actual.contains("no column names available"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("no column names available"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
assert!(
|
||||
actual.contains("can't rename"),
|
||||
format!("actual: {:?}", actual)
|
||||
actual.err.contains("can't rename"),
|
||||
format!("actual: {:?}", actual.err)
|
||||
);
|
||||
})
|
||||
}
|
||||
|
@ -7,5 +7,5 @@ fn can_get_reverse_first() {
|
||||
"ls | sort-by name | reverse | first 1 | get name | trim | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "utf16.ini");
|
||||
assert_eq!(actual.out, "utf16.ini");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::{files_exist_at, Stub::EmptyFile};
|
||||
use nu_test_support::nu;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error};
|
||||
|
||||
#[test]
|
||||
fn removes_a_file() {
|
||||
@ -126,37 +126,37 @@ fn errors_if_attempting_to_delete_a_directory_with_content_without_recursive_fla
|
||||
Playground::setup("rm_test_6", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("some_empty_file.txt")]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.root(),
|
||||
"rm rm_test_6"
|
||||
);
|
||||
|
||||
assert!(dirs.test().exists());
|
||||
assert!(actual.contains("cannot remove non-empty directory"));
|
||||
assert!(actual.err.contains("cannot remove non-empty directory"));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_if_attempting_to_delete_single_dot_as_argument() {
|
||||
Playground::setup("rm_test_7", |dirs, _| {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.root(),
|
||||
"rm ."
|
||||
);
|
||||
|
||||
assert!(actual.contains("cannot remove any parent directory"));
|
||||
assert!(actual.err.contains("cannot remove any parent directory"));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_if_attempting_to_delete_two_dot_as_argument() {
|
||||
Playground::setup("rm_test_8", |dirs, _| {
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.root(),
|
||||
"rm .."
|
||||
);
|
||||
|
||||
assert!(actual.contains("cannot remove any parent directory"));
|
||||
assert!(actual.err.contains("cannot remove any parent directory"));
|
||||
})
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ fn allows_doubly_specified_file() {
|
||||
Playground::glob_vec(&format!("{}/*", dirs.test().display())),
|
||||
Vec::<std::path::PathBuf>::new()
|
||||
);
|
||||
assert!(!actual.contains("error"))
|
||||
assert!(!actual.out.contains("error"))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn regular_columns() {
|
||||
Playground::setup("pick_test_1", |dirs, sandbox| {
|
||||
Playground::setup("select_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_caballeros.csv",
|
||||
r#"
|
||||
@ -19,20 +19,20 @@ fn regular_columns() {
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.csv
|
||||
| pick rusty_at last_name
|
||||
| select rusty_at last_name
|
||||
| nth 0
|
||||
| get last_name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "Robalino");
|
||||
assert_eq!(actual.out, "Robalino");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complex_nested_columns() {
|
||||
Playground::setup("pick_test_2", |dirs, sandbox| {
|
||||
Playground::setup("select_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_caballeros.json",
|
||||
r#"
|
||||
@ -62,20 +62,20 @@ fn complex_nested_columns() {
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.json
|
||||
| pick nu."0xATYKARNU" nu.committers.name nu.releases.version
|
||||
| select nu."0xATYKARNU" nu.committers.name nu.releases.version
|
||||
| where "nu.releases.version" > "0.8"
|
||||
| get "nu.releases.version"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "0.9999999");
|
||||
assert_eq!(actual.out, "0.9999999");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn allows_if_given_unknown_column_name_is_missing() {
|
||||
Playground::setup("pick_test_3", |dirs, sandbox| {
|
||||
Playground::setup("select_test_3", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_caballeros.csv",
|
||||
r#"
|
||||
@ -90,12 +90,12 @@ fn allows_if_given_unknown_column_name_is_missing() {
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.csv
|
||||
| pick rrusty_at first_name
|
||||
| select rrusty_at first_name
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
@ -12,7 +12,7 @@ fn semicolon_allows_lhs_to_complete() {
|
||||
let path = dirs.test().join("i_will_be_created_semi.txt");
|
||||
|
||||
assert!(path.exists());
|
||||
assert_eq!(actual, "done");
|
||||
assert_eq!(actual.out, "done");
|
||||
})
|
||||
}
|
||||
|
||||
@ -25,5 +25,5 @@ fn semicolon_lhs_error_stops_processing() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(!actual.contains("done"));
|
||||
assert!(!actual.out.contains("done"));
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ fn condition_is_met() {
|
||||
| skip 2
|
||||
| split-column ','
|
||||
| headers
|
||||
| skip-until "Chicken Collection" != "Red Chickens"
|
||||
| skip-until "Chicken Collection" == "Red Chickens"
|
||||
| str "31/04/2020" --to-int
|
||||
| get "31/04/2020"
|
||||
| sum
|
||||
@ -45,6 +45,6 @@ fn condition_is_met() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "12");
|
||||
assert_eq!(actual.out, "12");
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ fn by_column() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "description");
|
||||
assert_eq!(actual.out, "description");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -37,5 +37,5 @@ fn sort_primitive_values() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "authors = [\"The Nu Project Contributors\"]");
|
||||
assert_eq!(actual.out, "authors = [\"The Nu Project Contributors\"]");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use nu_test_support::fs::Stub::{EmptyFile, FileWithContentToBeTrimmed};
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_error, pipeline};
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn splits() {
|
||||
@ -27,7 +27,7 @@ fn splits() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
})
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ fn errors_if_no_table_given_as_input() {
|
||||
EmptyFile("arepas.clu"),
|
||||
]);
|
||||
|
||||
let actual = nu_error!(
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
ls
|
||||
@ -50,6 +50,6 @@ fn errors_if_no_table_given_as_input() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.contains("Expected table from pipeline"));
|
||||
assert!(actual.err.contains("Expected table from pipeline"));
|
||||
})
|
||||
}
|
||||
|
@ -16,5 +16,5 @@ fn by_column() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "name");
|
||||
assert_eq!(actual.out, "name");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ fn all() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "448");
|
||||
assert_eq!(actual.out, "448");
|
||||
})
|
||||
}
|
||||
|
||||
@ -57,6 +57,6 @@ fn outputs_zero_with_no_input() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "0");
|
||||
assert_eq!(actual.out, "0");
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ fn string() {
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(&commandline
|
||||
));
|
||||
assert_eq!(actual, test_string.trim())
|
||||
assert_eq!(actual.out, test_string.trim())
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -47,7 +47,7 @@ fn row() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, expected)
|
||||
assert_eq!(actual.out, expected.out)
|
||||
})
|
||||
}
|
||||
|
||||
@ -80,6 +80,6 @@ fn nested() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, expected)
|
||||
assert_eq!(actual.out, expected.out)
|
||||
})
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ fn removes_duplicate_rows() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -50,14 +50,14 @@ fn uniq_values() {
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.csv
|
||||
| pick type
|
||||
| select type
|
||||
| uniq
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
})
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ fn nested_json_structures() {
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual, "3");
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
||||
@ -138,5 +138,5 @@ fn uniq_when_keys_out_of_order() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ fn sets_the_column() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "0.7.0");
|
||||
assert_eq!(actual.out, "0.7.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -27,5 +27,5 @@ fn sets_the_column_from_a_block_run_output() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "0.7.0");
|
||||
assert_eq!(actual.out, "0.7.0");
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ fn filters_by_unit_size_comparison() {
|
||||
"ls | where size > 1kb | sort-by size | get name | first 1 | trim | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "cargo_sample.toml");
|
||||
assert_eq!(actual.out, "cargo_sample.toml");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -17,7 +17,7 @@ fn filters_with_nothing_comparison() {
|
||||
r#"echo '[{"foo": 3}, {"foo": null}, {"foo": 4}]' | from json | where foo > 1 | get foo | sum | echo $it"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "7");
|
||||
assert_eq!(actual.out, "7");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -27,7 +27,7 @@ fn where_in_table() {
|
||||
r#"echo '[{"name": "foo", "size": 3}, {"name": "foo", "size": 2}, {"name": "bar", "size": 4}]' | from json | where name in: ["foo"] | get size | sum | echo $it"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "5");
|
||||
assert_eq!(actual.out, "5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -37,7 +37,7 @@ fn where_not_in_table() {
|
||||
r#"echo '[{"name": "foo", "size": 3}, {"name": "foo", "size": 2}, {"name": "bar", "size": 4}]' | from json | where name not-in: ["foo"] | get size | sum | echo $it"#
|
||||
);
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -55,7 +55,7 @@ fn explicit_block_condition() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4253");
|
||||
assert_eq!(actual.out, "4253");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -73,7 +73,7 @@ fn binary_operator_comparisons() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4253");
|
||||
assert_eq!(actual.out, "4253");
|
||||
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
@ -88,7 +88,7 @@ fn binary_operator_comparisons() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4253");
|
||||
assert_eq!(actual.out, "4253");
|
||||
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
@ -103,7 +103,7 @@ fn binary_operator_comparisons() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
@ -118,7 +118,7 @@ fn binary_operator_comparisons() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "1");
|
||||
assert_eq!(actual.out, "1");
|
||||
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
@ -133,7 +133,7 @@ fn binary_operator_comparisons() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "42");
|
||||
assert_eq!(actual.out, "42");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -150,7 +150,7 @@ fn contains_operator() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "4");
|
||||
assert_eq!(actual.out, "4");
|
||||
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
@ -164,5 +164,5 @@ fn contains_operator() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "2");
|
||||
assert_eq!(actual.out, "2");
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ fn with_env_extends_environment() {
|
||||
"with-env [FOO BARRRR] {echo $nu.env} | get FOO"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "BARRRR");
|
||||
assert_eq!(actual.out, "BARRRR");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -17,5 +17,5 @@ fn with_env_shorthand() {
|
||||
"FOO=BARRRR echo $nu.env | get FOO"
|
||||
);
|
||||
|
||||
assert_eq!(actual, "BARRRR");
|
||||
assert_eq!(actual.out, "BARRRR");
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ fn wrap_rows_into_a_row() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "Robalino");
|
||||
assert_eq!(actual.out, "Robalino");
|
||||
})
|
||||
}
|
||||
|
||||
@ -58,6 +58,6 @@ fn wrap_rows_into_a_table() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "Katz");
|
||||
assert_eq!(actual.out, "Katz");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user