Skip to content

Commit

Permalink
Merge pull request #3390 from sylvestre/mv-test
Browse files Browse the repository at this point in the history
mv: move the tests in a separate function
  • Loading branch information
sylvestre authored Apr 12, 2022
2 parents 0f59af2 + 57b8caf commit 5c3580f
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions tests/by-util/test_mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5c3580f

Please sign in to comment.