mirror of
https://github.com/uutils/coreutils
synced 2025-01-19 00:24:13 +00:00
use existing fixture file instead of new ones
This commit is contained in:
parent
c49d8e6113
commit
30f03b3ded
1 changed files with 7 additions and 10 deletions
|
@ -38,8 +38,6 @@ static TEST_COPY_FROM_FOLDER: &str = "hello_dir_with_file/";
|
|||
static TEST_COPY_FROM_FOLDER_FILE: &str = "hello_dir_with_file/hello_world.txt";
|
||||
static TEST_COPY_TO_FOLDER_NEW: &str = "hello_dir_new";
|
||||
static TEST_COPY_TO_FOLDER_NEW_FILE: &str = "hello_dir_new/hello_world.txt";
|
||||
static TEST_PROTECT_BACKUP_SRC: &str = "protected.txt.bak";
|
||||
static TEST_PROTECT_BACKUP_DEST: &str = "protected.txt";
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
|
||||
static TEST_MOUNT_COPY_FROM_FOLDER: &str = "dir_with_mount";
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
|
||||
|
@ -563,20 +561,19 @@ fn test_cp_backup_simple() {
|
|||
#[test]
|
||||
fn test_cp_backup_simple_protect_source() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let source = format!("{}~", TEST_HELLO_WORLD_SOURCE);
|
||||
at.touch(&source);
|
||||
ucmd.arg("--backup=simple")
|
||||
.arg("--suffix")
|
||||
.arg(".bak")
|
||||
.arg(TEST_PROTECT_BACKUP_SRC)
|
||||
.arg(TEST_PROTECT_BACKUP_DEST)
|
||||
.arg(&source)
|
||||
.arg(TEST_HELLO_WORLD_SOURCE)
|
||||
.fails()
|
||||
.stderr_only(format!(
|
||||
"cp: backing up '{}' might destroy source; '{}' not copied",
|
||||
TEST_PROTECT_BACKUP_DEST,
|
||||
TEST_PROTECT_BACKUP_SRC,
|
||||
TEST_HELLO_WORLD_SOURCE, source,
|
||||
));
|
||||
|
||||
assert_eq!(at.read(TEST_PROTECT_BACKUP_SRC), "original text\n");
|
||||
assert_eq!(at.read(TEST_PROTECT_BACKUP_DEST), "new text\n");
|
||||
assert_eq!(at.read(TEST_HELLO_WORLD_SOURCE), "Hello, World!\n");
|
||||
assert_eq!(at.read(&source), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue