remove without check path exist, rm -f (#2590)

This commit is contained in:
Luccas Mateus
2020-09-22 18:11:31 -03:00
committed by GitHub
parent ebba89ea31
commit e8ec5027ff
3 changed files with 21 additions and 2 deletions

View File

@ -125,7 +125,6 @@ fn removes_directory_contents_with_recursive_flag() {
fn errors_if_attempting_to_delete_a_directory_with_content_without_recursive_flag() {
Playground::setup("rm_test_6", |dirs, sandbox| {
sandbox.with_files(vec![EmptyFile("some_empty_file.txt")]);
let actual = nu!(
cwd: dirs.root(),
"rm rm_test_6"
@ -265,3 +264,15 @@ fn remove_files_from_two_parents_up_using_multiple_dots_and_glob() {
));
})
}
#[test]
fn no_errors_if_attempting_to_delete_non_existent_file_with_f_flag() {
Playground::setup("rm_test_14", |dirs, _| {
let actual = nu!(
cwd: dirs.root(),
"rm -f non_existent_file.txt"
);
assert!(!actual.err.contains("no valid path"));
})
}