From 57b8caf1d06829380ebc7d73ebd1ddf33dc9d8ea Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 12 Apr 2022 20:39:00 +0200 Subject: [PATCH] mv: move the tests in a separate function --- tests/by-util/test_mv.rs | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index fc0f9c18e..97e56bf6a 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -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