From 85cb9aca94a781e8de638e529f84385577300f71 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Tue, 30 Jun 2015 23:17:16 -0400 Subject: [PATCH] Add a test --- test/mv.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/mv.rs b/test/mv.rs index ad3df4e82..d99ff19ae 100644 --- a/test/mv.rs +++ b/test/mv.rs @@ -57,6 +57,28 @@ fn test_mv_move_file_into_dir() { assert!(Path::new(&format!("{}/{}", dir, file)).is_file()); } +#[test] +fn test_mv_strip_slashes() { + let dir = "test_mv_strip_slashes_dir"; + let file = "test_mv_strip_slashes_file"; + let mut source = file.to_owned(); + source.push_str("/"); + + mkdir(dir); + touch(file); + + let result = run(Command::new(PROGNAME).arg(&source).arg(dir)); + assert!(!result.success); + + assert!(!Path::new(&format!("{}/{}", dir, file)).is_file()); + + let result = run(Command::new(PROGNAME).arg("--strip-trailing-slashes").arg(source).arg(dir)); + assert_empty_stderr!(result); + assert!(result.success); + + assert!(Path::new(&format!("{}/{}", dir, file)).is_file()); +} + #[test] fn test_mv_multiple_files() { let target_dir = "test_mv_multiple_files_dir";