mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge pull request #3586 from jfinkels/mktemp-multiple-x-sequences
mktemp: only replace last contiguous block of Xs
This commit is contained in:
commit
3f203c7ab1
2 changed files with 60 additions and 4 deletions
|
@ -597,3 +597,25 @@ fn test_too_few_xs_suffix_directory() {
|
|||
fn test_too_many_arguments() {
|
||||
new_ucmd!().args(&["-q", "a", "b"]).fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_two_contiguous_wildcard_blocks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let template = "XXX_XXX";
|
||||
let result = ucmd.arg(template).succeeds();
|
||||
let filename = result.no_stderr().stdout_str().trim_end();
|
||||
assert_eq!(&filename[..4], "XXX_");
|
||||
assert_matches_template!(template, filename);
|
||||
assert!(at.file_exists(filename));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_three_contiguous_wildcard_blocks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let template = "XXX_XXX_XXX";
|
||||
let result = ucmd.arg(template).succeeds();
|
||||
let filename = result.no_stderr().stdout_str().trim_end();
|
||||
assert_eq!(&filename[..8], "XXX_XXX_");
|
||||
assert_matches_template!(template, filename);
|
||||
assert!(at.file_exists(filename));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue