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

mktemp: respect POSIXLY_CORRECT env var when parsing args

Signed-off-by: Junji Wei <harukawei99@gmail.com>
This commit is contained in:
Junji Wei 2022-06-09 14:48:05 +08:00
parent 702a0b7a34
commit 1ba0bfc67a
2 changed files with 45 additions and 2 deletions

View file

@ -641,3 +641,25 @@ fn test_suffix_empty_template() {
.fails()
.stderr_is("mktemp: with --suffix, template '' must end in X\n");
}
#[test]
fn test_mktemp_with_posixly_correct() {
let scene = TestScenario::new(util_name!());
scene
.ucmd()
.env("POSIXLY_CORRECT", "1")
.args(&["aXXXX", "--suffix=b"])
.fails()
.stderr_is(&format!(
"mktemp: too many templates\nTry '{} {} --help' for more information.\n",
scene.bin_path.to_string_lossy(),
scene.util_name
));
scene
.ucmd()
.env("POSIXLY_CORRECT", "1")
.args(&["--suffix=b", "aXXXX"])
.succeeds();
}