mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
uucore: allow backup suffix with hyphen value
This commit is contained in:
parent
dfc661e8b5
commit
184b65df20
5 changed files with 101 additions and 0 deletions
|
@ -180,6 +180,33 @@ fn test_symlink_custom_backup_suffix() {
|
|||
assert_eq!(at.resolve_link(backup), file);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_symlink_custom_backup_suffix_hyphen_value() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "test_symlink_custom_backup_suffix";
|
||||
let link = "test_symlink_custom_backup_suffix_link";
|
||||
let suffix = "-v";
|
||||
|
||||
at.touch(file);
|
||||
at.symlink_file(file, link);
|
||||
assert!(at.file_exists(file));
|
||||
assert!(at.is_symlink(link));
|
||||
assert_eq!(at.resolve_link(link), file);
|
||||
|
||||
let arg = &format!("--suffix={}", suffix);
|
||||
ucmd.args(&["-b", arg, "-s", file, link])
|
||||
.succeeds()
|
||||
.no_stderr();
|
||||
assert!(at.file_exists(file));
|
||||
|
||||
assert!(at.is_symlink(link));
|
||||
assert_eq!(at.resolve_link(link), file);
|
||||
|
||||
let backup = &format!("{}{}", link, suffix);
|
||||
assert!(at.is_symlink(backup));
|
||||
assert_eq!(at.resolve_link(backup), file);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_symlink_backup_numbering() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue