From eeb3341101f9bcb500f51e4b242850bbd831e5cd Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 22 May 2023 21:23:44 -0700 Subject: [PATCH] rm: add tests for --interactive with empty when --- tests/by-util/test_rm.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index a5c342ffe..85d96d2ee 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -361,6 +361,26 @@ fn test_rm_interactive_never() { assert!(!at.file_exists(file_2)); } +#[test] +fn test_rm_interactive_missing_value() { + // `--interactive` is equivalent to `--interactive=always` or `-i` + let (at, mut ucmd) = at_and_ucmd!(); + + let file1 = "test_rm_interactive_missing_value_file1"; + let file2 = "test_rm_interactive_missing_value_file2"; + + at.touch(file1); + at.touch(file2); + + ucmd.arg("--interactive") + .arg(file1) + .arg(file2) + .pipe_in("y\ny") + .succeeds(); + + assert!(!at.file_exists(file1)); + assert!(!at.file_exists(file2)); +} #[test] fn test_rm_descend_directory() { // This test descends into each directory and deletes the files and folders inside of them