mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
mktemp: error on empty --suffix in some situations
Make `mktemp` exit with an error if the `--suffix` option is the empty string and the template argument does not end in an "X". Previously, the program succeeded. Before this commit, $ mktemp --suffix= aXXXb apBEb After this commit, $ mktemp --suffix= aXXXb mktemp: with --suffix, template 'aXXXb' must end in X
This commit is contained in:
parent
3a45f00fed
commit
6da070cdd3
2 changed files with 27 additions and 3 deletions
|
@ -619,3 +619,25 @@ fn test_three_contiguous_wildcard_blocks() {
|
|||
assert_matches_template!(template, filename);
|
||||
assert!(at.file_exists(filename));
|
||||
}
|
||||
|
||||
/// Test that template must end in X even if `--suffix` is the empty string.
|
||||
#[test]
|
||||
fn test_suffix_must_end_in_x() {
|
||||
new_ucmd!()
|
||||
.args(&["--suffix=", "aXXXb"])
|
||||
.fails()
|
||||
.stderr_is("mktemp: with --suffix, template 'aXXXb' must end in X\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_suffix_empty_template() {
|
||||
new_ucmd!()
|
||||
.args(&["--suffix=aXXXb", ""])
|
||||
.fails()
|
||||
.stderr_is("mktemp: with --suffix, template '' must end in X\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-d", "--suffix=aXXXb", ""])
|
||||
.fails()
|
||||
.stderr_is("mktemp: with --suffix, template '' must end in X\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue