Add not-in: operator (#1661)

This commit is contained in:
Jonathan Turner
2020-04-26 17:32:17 +12:00
committed by GitHub
parent ad8ab5b04d
commit ad7a3fd908
5 changed files with 36 additions and 1 deletions

View File

@ -20,6 +20,26 @@ fn filters_with_nothing_comparison() {
assert_eq!(actual, "7");
}
#[test]
fn where_in_table() {
let actual = nu!(
cwd: "tests/fixtures/formats",
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");
}
#[test]
fn where_not_in_table() {
let actual = nu!(
cwd: "tests/fixtures/formats",
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");
}
#[test]
fn explicit_block_condition() {
let actual = nu!(