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

mktemp: include suffix in error message

Include the suffix in the error message produced by `mktemp` when
there are too few Xs in the template. Before this commit,

    $ mktemp --suffix=X aXX
    mktemp: too few X's in template 'aXX'

After this commit,

    $ mktemp --suffix=X aXX
    mktemp: too few X's in template 'aXXX'

This matches the behavior of GNU `mktemp`.
This commit is contained in:
Jeffrey Finkelstein 2022-05-21 21:58:38 -04:00
parent d92107362b
commit 35fb4e6ea1
2 changed files with 21 additions and 1 deletions

View file

@ -527,3 +527,19 @@ fn test_suffix_path_separator() {
.fails()
.stderr_only("mktemp: invalid suffix '\\b', contains directory separator\n");
}
#[test]
fn test_too_few_xs_suffix() {
new_ucmd!()
.args(&["--suffix=X", "aXX"])
.fails()
.stderr_only("mktemp: too few X's in template 'aXXX'\n");
}
#[test]
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");
}