mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 14:36:08 +02:00
making ls
and du
supports rest parameters. (#12327)
# Description Close: #12147 Close: #11796 About the change: it make pattern handling into a function: `ls_for_one_pattern`(for ls), `du_for_one_pattern`(for du). Then iterates on user input pattern, call these core function, and chaining these iterator to one pipelinedata.
This commit is contained in:
@ -733,3 +733,29 @@ fn list_with_tilde() {
|
||||
assert!(actual.out.contains("~tilde"));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_with_multiple_path() {
|
||||
Playground::setup("ls_multiple_path", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
EmptyFile("f1.txt"),
|
||||
EmptyFile("f2.txt"),
|
||||
EmptyFile("f3.txt"),
|
||||
]);
|
||||
|
||||
let actual = nu!(cwd: dirs.test(), "ls f1.txt f2.txt");
|
||||
assert!(actual.out.contains("f1.txt"));
|
||||
assert!(actual.out.contains("f2.txt"));
|
||||
assert!(!actual.out.contains("f3.txt"));
|
||||
assert!(actual.status.success());
|
||||
|
||||
// report errors if one path not exists
|
||||
let actual = nu!(cwd: dirs.test(), "ls asdf f1.txt");
|
||||
assert!(actual.err.contains("directory not found"));
|
||||
assert!(!actual.status.success());
|
||||
|
||||
// ls with spreading empty list should returns nothing.
|
||||
let actual = nu!(cwd: dirs.test(), "ls ...[] | length");
|
||||
assert_eq!(actual.out, "0");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user