mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fix ignore-errors for select (#6896)
* Fix ignore-errors for select * fix Value::List match * fix invalid rows * add tests * fix ListStream match * add one more test for ListStream * add more tests * tweak words
This commit is contained in:
@ -169,6 +169,7 @@ fn select_ignores_errors_succesfully1() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
@ -181,5 +182,87 @@ fn select_ignores_errors_succesfully2() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_ignores_errors_succesfull3() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"sys | select -i invalid_key"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_ignores_errors_succesfully4() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[a b c] | select -i invalid_key"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_ignores_errors_successfully5() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[a b c] | select -i 0.0"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_ignores_errors_successfully6() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#""key val\na 1\nb 2\n" | lines | split column -c " " | select -i "100""#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_failed1() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[{a: 1, b: 2} {a: 3, b: 5} {a: 3}] | select b
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.contains("cannot find column"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_failed2() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[{a: 1} {a: 2} {a: 3}] | select b
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.contains("cannot find column"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_failed3() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#""key val\na 1\nb 2\n" | lines | split column -c " " | select "100""#
|
||||
));
|
||||
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.contains("cannot find column"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user