forked from extern/nushell
Make opening a directory list its contents (#3118)
* Make opening a directory enter it. Not sure if this change is wanted, but I'm not sure what else opening a directory could mean. And I find myself accidentally using `open <dir>` to mean `enter <dir>` * Add example to open directory * Open dir should list it's contents * Update example description and fix style
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
use nu_test_support::fs::Stub::EmptyFile;
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, pipeline};
|
||||
@ -230,3 +231,24 @@ fn errors_if_file_not_found() {
|
||||
expected
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_dir_is_ls() {
|
||||
Playground::setup("open_dir", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
EmptyFile("yehuda.txt"),
|
||||
EmptyFile("jonathan.txt"),
|
||||
EmptyFile("andres.txt"),
|
||||
]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open .
|
||||
| count
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "3");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user