Merge pull request #3390 from sylvestre/mv-test

mv: move the tests in a separate function
This commit is contained in:
Sylvestre Ledru 2022-04-12 22:36:24 +02:00 committed by GitHub
commit 5c3580fb04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -748,19 +748,6 @@ fn test_mv_errors() {
.fails()
.stderr_str()
.is_empty());
// $ at.mkdir dir && at.touch file
// $ mv -i dir file
// err == mv: cannot overwrite non-directory 'file' with directory 'dir'
assert!(!scene
.ucmd()
.arg("-i")
.arg(dir)
.arg(file_a)
.pipe_in("y")
.fails()
.stderr_str()
.is_empty());
}
#[test]
@ -813,6 +800,29 @@ fn test_mv_permission_error() {
.stderr_contains("Permission denied");
}
#[test]
fn test_mv_interactive_error() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let dir = "test_mv_errors_dir";
let file_a = "test_mv_errors_file_a";
at.mkdir(dir);
at.touch(file_a);
// $ at.mkdir dir && at.touch file
// $ mv -i dir file
// err == mv: cannot overwrite non-directory 'file' with directory 'dir'
assert!(!scene
.ucmd()
.arg("-i")
.arg(dir)
.arg(file_a)
.pipe_in("y")
.fails()
.stderr_str()
.is_empty());
}
// Todo:
// $ at.touch a b