From 31ca885c9cf7ac896216da1b7a2e9ad4fb82a39d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 22 Sep 2018 23:34:28 -0500 Subject: [PATCH] mv: add test for "`mv` fails transfers between dirs" --- tests/test_mv.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_mv.rs b/tests/test_mv.rs index 1cf56ce0b..cccaa7e56 100644 --- a/tests/test_mv.rs +++ b/tests/test_mv.rs @@ -44,6 +44,25 @@ fn test_mv_move_file_into_dir() { assert!(at.file_exists(&format!("{}/{}", dir, file))); } +#[test] +fn test_mv_move_file_between_dirs() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "test_mv_move_file_between_dirs_dir1"; + let dir2 = "test_mv_move_file_between_dirs_dir2"; + let file = "test_mv_move_file_between_dirs_file"; + + at.mkdir(dir1); + at.mkdir(dir2); + at.touch(&format!("{}/{}", dir1, file)); + + assert!(at.file_exists(&format!("{}/{}", dir1, file))); + + ucmd.arg(&format!("{}/{}", dir1, file)).arg(dir2).succeeds().no_stderr(); + + assert!(!at.file_exists(&format!("{}/{}", dir1, file))); + assert!(at.file_exists(&format!("{}/{}", dir2, file))); +} + #[test] fn test_mv_strip_slashes() { let scene = TestScenario::new(util_name!());