mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 03:26:03 +02:00
reject
multiple row args support (#10163)
# Description This PR fixes `reject` failing when providing row items in ascending order. # User-Facing Changes users can now `reject` multiple rows independently of each other. ```nushell let foo = [[a b]; [ 1 2] [3 4] [ 5 6]] # this will work independant of the order print ($foo | reject 2 1) print ($foo | reject 1 2) ``` --------- Co-authored-by: Antoine Stevan <44101798+amtoine@users.noreply.github.com>
This commit is contained in:
@@ -79,6 +79,12 @@ fn ignores_duplicate_columns_rejected() {
|
||||
assert_eq!(actual.out, "last name");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignores_duplicate_rows_rejected() {
|
||||
let actual = nu!("[[a,b];[1 2] [3 4] [5 6]] | reject 2 2 | to nuon");
|
||||
assert_eq!(actual.out, "[[a, b]; [1, 2], [3, 4]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reject_record_from_raw_eval() {
|
||||
let actual = nu!(r#"{"a": 3} | reject a | describe"#);
|
||||
@@ -143,3 +149,15 @@ fn reject_optional_row() {
|
||||
let actual = nu!("[{foo: 'bar'}] | reject 3? | to nuon");
|
||||
assert_eq!(actual.out, "[[foo]; [bar]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reject_multiple_rows_ascending() {
|
||||
let actual = nu!("[[a,b];[1 2] [3 4] [5 6]] | reject 1 2 | to nuon");
|
||||
assert_eq!(actual.out, "[[a, b]; [1, 2]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reject_multiple_rows_descending() {
|
||||
let actual = nu!("[[a,b];[1 2] [3 4] [5 6]] | reject 2 1 | to nuon");
|
||||
assert_eq!(actual.out, "[[a, b]; [1, 2]]");
|
||||
}
|
||||
|
Reference in New Issue
Block a user