forked from extern/nushell
update reject
to be able to recive arg list (#10216)
This PR is in relation to #10215 # Description This PR introduces `reject` to receive list of columns or rows as argument. This change is similar to change of `select` and the code used is similar. # User-Facing Changes The user will be able to pass a list as rejection arguments. ```nushell let arg = [ type size ] [[name type size]; [ cargo.toml file 20mb ] [ Cargo.lock file 20mb] [src dir 100mb]] | reject $arg ```
This commit is contained in:
@ -150,6 +150,30 @@ fn reject_optional_row() {
|
||||
assert_eq!(actual.out, "[[foo]; [bar]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reject_list_columns() {
|
||||
let actual = nu!("let arg = [type size]; [[name type size];[Cargo.toml file 10mb] [Cargo.lock file 10mb] [src dir 100mb]] | reject $arg | to nuon");
|
||||
assert_eq!(actual.out, "[[name]; [Cargo.toml], [Cargo.lock], [src]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reject_list_rows() {
|
||||
let actual = nu!("let arg = [2 0]; [[name type size];[Cargo.toml file 10mb] [Cargo.lock file 10mb] [src dir 100mb]] | reject $arg | to nuon");
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"[[name, type, size]; [Cargo.lock, file, 10000000b]]"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rject_list_mixed() {
|
||||
let actual = nu!("let arg = [ type 2]; [[name type size];[Cargp.toml file 10mb] [ Cargo.lock file 10mb] [src dir 100mb]] | reject $arg | to nuon");
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"[[name, size]; [Cargp.toml, 10000000b], [Cargo.lock, 10000000b]]"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reject_multiple_rows_ascending() {
|
||||
let actual = nu!("[[a,b];[1 2] [3 4] [5 6]] | reject 1 2 | to nuon");
|
||||
|
Reference in New Issue
Block a user