mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
more test fixes (#4499)
* more test fixes * update multi-os err messages
This commit is contained in:
parent
5b6156687e
commit
b64ac9eb7b
6 changed files with 40 additions and 34 deletions
|
@ -71,8 +71,6 @@ fn errors_if_given_unknown_column_name() {
|
|||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_block_given_evaluates_more_than_one_row() {
|
||||
Playground::setup("group_by_test_3", |dirs, sandbox| {
|
||||
|
@ -94,7 +92,8 @@ fn errors_if_block_given_evaluates_more_than_one_row() {
|
|||
"#
|
||||
));
|
||||
|
||||
assert!(actual.err.contains("Unknown column"));
|
||||
assert!(actual.err.contains("value originates here"),);
|
||||
assert!(actual.err.contains("cannot find column"),);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -195,8 +195,6 @@ fn moves_a_directory_with_files() {
|
|||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_source_doesnt_exist() {
|
||||
Playground::setup("mv_test_10", |dirs, sandbox| {
|
||||
|
@ -205,12 +203,10 @@ fn errors_if_source_doesnt_exist() {
|
|||
cwd: dirs.test(),
|
||||
"mv non-existing-file test_folder/"
|
||||
);
|
||||
assert!(actual.err.contains("Invalid file or pattern"));
|
||||
assert!(actual.err.contains("invalid file or pattern"));
|
||||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_destination_doesnt_exist() {
|
||||
Playground::setup("mv_test_10_1", |dirs, sandbox| {
|
||||
|
@ -221,12 +217,10 @@ fn errors_if_destination_doesnt_exist() {
|
|||
"mv empty.txt does/not/exist"
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("Destination directory does not exist"));
|
||||
assert!(actual.err.contains("directory not found"));
|
||||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_multiple_sources_but_destination_not_a_directory() {
|
||||
Playground::setup("mv_test_10_2", |dirs, sandbox| {
|
||||
|
@ -247,8 +241,6 @@ fn errors_if_multiple_sources_but_destination_not_a_directory() {
|
|||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_renaming_directory_to_an_existing_file() {
|
||||
Playground::setup("mv_test_10_3", |dirs, sandbox| {
|
||||
|
@ -261,12 +253,11 @@ fn errors_if_renaming_directory_to_an_existing_file() {
|
|||
"mv mydir empty.txt"
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("Cannot rename a directory to a file"));
|
||||
assert!(actual.err.contains("Can't move a directory"),);
|
||||
assert!(actual.err.contains("to a file"),);
|
||||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_moving_to_itself() {
|
||||
Playground::setup("mv_test_10_4", |dirs, sandbox| {
|
||||
|
|
|
@ -184,6 +184,19 @@ fn parses_json() {
|
|||
assert_eq!(actual.out, "markup")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_xml() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open jonathan.xml | get rss.children.channel.children | get item.children | get link.children.0.3.3.0"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"http://www.jonathanturner.org/2015/10/off-to-new-adventures.html"
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_ini() {
|
||||
let actual = nu!(
|
||||
|
@ -204,15 +217,19 @@ fn parses_utf16_ini() {
|
|||
assert_eq!(actual.out, "-236")
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_file_not_found() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open i_dont_exist.txt"
|
||||
);
|
||||
let expected = "Cannot find file";
|
||||
|
||||
#[cfg(windows)]
|
||||
let expected = "The system cannot find the file specified. (os error 2)";
|
||||
|
||||
#[cfg(not(windows))]
|
||||
let expected = "No such file or directory (os error 2)";
|
||||
|
||||
assert!(
|
||||
actual.err.contains(expected),
|
||||
"Error:\n{}\ndoes not contain{}",
|
||||
|
|
|
@ -5,8 +5,6 @@ use nu_test_support::{nu, pipeline};
|
|||
mod simple {
|
||||
use super::*;
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn extracts_fields_from_the_given_the_pattern() {
|
||||
Playground::setup("parse_test_1", |dirs, sandbox| {
|
||||
|
@ -25,7 +23,8 @@ mod simple {
|
|||
open key_value_separated_arepa_ingredients.txt
|
||||
| lines
|
||||
| each { echo $it | parse "{Name}={Value}" }
|
||||
| select 1
|
||||
| flatten
|
||||
| get 1
|
||||
| get Value
|
||||
"#
|
||||
));
|
||||
|
@ -83,8 +82,6 @@ mod simple {
|
|||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_when_missing_closing_brace() {
|
||||
Playground::setup("parse_test_regex_5", |dirs, _sandbox| {
|
||||
|
@ -97,7 +94,9 @@ mod simple {
|
|||
"#
|
||||
));
|
||||
|
||||
assert!(actual.err.contains("invalid parse pattern"));
|
||||
assert!(actual
|
||||
.err
|
||||
.contains("Found opening `{` without an associated closing `}`"));
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,8 +114,6 @@ fn parses_column_path_extension() {
|
|||
assert_eq!(actual.out, "png");
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn parses_into_correct_number_of_columns() {
|
||||
let actual = nu!(
|
||||
|
@ -123,7 +121,7 @@ fn parses_into_correct_number_of_columns() {
|
|||
r#"
|
||||
echo 'home/viking/spam.txt'
|
||||
| path parse
|
||||
| pivot
|
||||
| transpose
|
||||
| get Column0
|
||||
| length
|
||||
"#
|
||||
|
|
|
@ -23,7 +23,7 @@ fn removes_duplicate_rows() {
|
|||
open los_tres_caballeros.csv
|
||||
| uniq
|
||||
| length
|
||||
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -53,7 +53,7 @@ fn uniq_values() {
|
|||
| select type
|
||||
| uniq
|
||||
| length
|
||||
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -120,7 +120,7 @@ fn nested_json_structures() {
|
|||
open nested_json_structures.json
|
||||
| uniq
|
||||
| length
|
||||
|
||||
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "3");
|
||||
|
@ -137,15 +137,13 @@ fn uniq_when_keys_out_of_order() {
|
|||
[{"a": "a", "b": [1,2,3]}, {"b": [1,2,3], "a": "a"}]
|
||||
| uniq
|
||||
| length
|
||||
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn uniq_counting() {
|
||||
let actual = nu!(
|
||||
|
@ -154,8 +152,10 @@ fn uniq_counting() {
|
|||
["A", "B", "A"]
|
||||
| wrap item
|
||||
| uniq --count
|
||||
| flatten
|
||||
| where item == A
|
||||
| get count
|
||||
| get 0
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "2");
|
||||
|
@ -166,8 +166,10 @@ fn uniq_counting() {
|
|||
echo ["A", "B", "A"]
|
||||
| wrap item
|
||||
| uniq --count
|
||||
| flatten
|
||||
| where item == B
|
||||
| get count
|
||||
| get 0
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "1");
|
||||
|
|
Loading…
Reference in a new issue