mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +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_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: &str = "hello_dir_new";
|
||||||
static TEST_COPY_TO_FOLDER_NEW_FILE: &str = "hello_dir_new/hello_world.txt";
|
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"))]
|
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
|
||||||
static TEST_MOUNT_COPY_FROM_FOLDER: &str = "dir_with_mount";
|
static TEST_MOUNT_COPY_FROM_FOLDER: &str = "dir_with_mount";
|
||||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
|
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
|
||||||
|
@ -563,20 +561,19 @@ fn test_cp_backup_simple() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cp_backup_simple_protect_source() {
|
fn test_cp_backup_simple_protect_source() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
let source = format!("{}~", TEST_HELLO_WORLD_SOURCE);
|
||||||
|
at.touch(&source);
|
||||||
ucmd.arg("--backup=simple")
|
ucmd.arg("--backup=simple")
|
||||||
.arg("--suffix")
|
.arg(&source)
|
||||||
.arg(".bak")
|
.arg(TEST_HELLO_WORLD_SOURCE)
|
||||||
.arg(TEST_PROTECT_BACKUP_SRC)
|
|
||||||
.arg(TEST_PROTECT_BACKUP_DEST)
|
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_only(format!(
|
.stderr_only(format!(
|
||||||
"cp: backing up '{}' might destroy source; '{}' not copied",
|
"cp: backing up '{}' might destroy source; '{}' not copied",
|
||||||
TEST_PROTECT_BACKUP_DEST,
|
TEST_HELLO_WORLD_SOURCE, source,
|
||||||
TEST_PROTECT_BACKUP_SRC,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(at.read(TEST_PROTECT_BACKUP_SRC), "original text\n");
|
assert_eq!(at.read(TEST_HELLO_WORLD_SOURCE), "Hello, World!\n");
|
||||||
assert_eq!(at.read(TEST_PROTECT_BACKUP_DEST), "new text\n");
|
assert_eq!(at.read(&source), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue