mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #6146 from sylvestre/mktemp
mktemp: adjust the error message to match 9.5
This commit is contained in:
commit
28f7d56f6d
2 changed files with 8 additions and 3 deletions
|
@ -236,8 +236,13 @@ impl Params {
|
||||||
let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
|
let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
|
||||||
None => {
|
None => {
|
||||||
let s = match options.suffix {
|
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,
|
None => options.template,
|
||||||
Some(s) => format!("{}{}", options.template, s),
|
|
||||||
};
|
};
|
||||||
return Err(MkTempError::TooFewXs(s));
|
return Err(MkTempError::TooFewXs(s));
|
||||||
}
|
}
|
||||||
|
|
|
@ -629,7 +629,7 @@ fn test_too_few_xs_suffix() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["--suffix=X", "aXX"])
|
.args(&["--suffix=X", "aXX"])
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_only("mktemp: too few X's in template 'aXXX'\n");
|
.stderr_only("mktemp: too few X's in template 'aXX'\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -637,7 +637,7 @@ fn test_too_few_xs_suffix_directory() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["-d", "--suffix=X", "aXX"])
|
.args(&["-d", "--suffix=X", "aXX"])
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_only("mktemp: too few X's in template 'aXXX'\n");
|
.stderr_only("mktemp: too few X's in template 'aXX'\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue