ls **/* does not show hidden files without the -a flag (#2407)

* fixed: .*.(ext|*)

* ls **/* does not return hidden files without the -a flag

* fixed formatting

* fixed clippy issues

* fixed clippy issues, v2

* added `#[cfg(unix)]` to windows-failing test
This commit is contained in:
Abhi V
2020-09-05 01:02:58 +05:30
committed by GitHub
parent 2ae2f2ea9d
commit 16f85f32a2
2 changed files with 58 additions and 0 deletions

View File

@ -214,6 +214,44 @@ fn lists_all_hidden_files_when_glob_contains_dot() {
})
}
#[test]
// TODO Remove this cfg value when we have an OS-agnostic way
// of creating hidden files using the playground.
#[cfg(unix)]
fn lists_all_hidden_files_when_glob_does_not_contain_dot() {
Playground::setup("ls_test_8", |dirs, sandbox| {
sandbox
.with_files(vec![
EmptyFile("root1.txt"),
EmptyFile("root2.txt"),
EmptyFile(".dotfile1"),
])
.within("dir_a")
.with_files(vec![
EmptyFile("yehuda.10.txt"),
EmptyFile("jonathan.10.txt"),
EmptyFile(".dotfile2"),
])
.within(".dir_b")
.with_files(vec![
EmptyFile("andres.10.txt"),
EmptyFile("chicken_not_to_be_picked_up.100.txt"),
EmptyFile(".dotfile3"),
]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
ls **/*
| count
| echo $it
"#
));
assert_eq!(actual.out, "5");
})
}
#[test]
fn list_all_columns() {
Playground::setup(