1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

mktemp: adjust the error message to match 9.5

This commit is contained in:
Sylvestre Ledru 2024-03-29 21:48:38 +01:00
parent 8ae8de0cad
commit ee198126af
2 changed files with 8 additions and 3 deletions

View file

@ -236,8 +236,13 @@ impl Params {
let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
None => {
let s = match options.suffix {
// If a suffix is specified, the error message includes the template without the suffix.
Some(_) => options
.template
.chars()
.take(options.template.len())
.collect::<String>(),
None => options.template,
Some(s) => format!("{}{}", options.template, s),
};
return Err(MkTempError::TooFewXs(s));
}

View file

@ -629,7 +629,7 @@ fn test_too_few_xs_suffix() {
new_ucmd!()
.args(&["--suffix=X", "aXX"])
.fails()
.stderr_only("mktemp: too few X's in template 'aXXX'\n");
.stderr_only("mktemp: too few X's in template 'aXX'\n");
}
#[test]
@ -637,7 +637,7 @@ fn test_too_few_xs_suffix_directory() {
new_ucmd!()
.args(&["-d", "--suffix=X", "aXX"])
.fails()
.stderr_only("mktemp: too few X's in template 'aXXX'\n");
.stderr_only("mktemp: too few X's in template 'aXX'\n");
}
#[test]