mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 04:57:45 +00:00
Add a test
This commit is contained in:
parent
b8d5602655
commit
85cb9aca94
1 changed files with 22 additions and 0 deletions
22
test/mv.rs
22
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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue