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

mktemp: add tests UNIX and POSIX to check path in prefix

This commit is contained in:
ZauJulio 2023-02-28 12:38:18 -03:00
parent 5c3bb90df2
commit 9b4fb0cb6e
No known key found for this signature in database
GPG key ID: 5AC499A308A063B8

View file

@ -578,6 +578,26 @@ fn test_prefix_template_separator() {
new_ucmd!().args(&["-t", TEST_TEMPLATE9]).succeeds();
}
#[test]
fn test_prefix_template_with_path_separator() {
#[cfg(not(windows))]
new_ucmd!()
.args(&["-t", "a/XXX"])
.fails()
.stderr_only(format!(
"mktemp: invalid template, {}, contains directory separator\n",
"a/XXX".quote()
));
#[cfg(windows)]
new_ucmd!()
.args(&["-t", r"a\XXX"])
.fails()
.stderr_only(format!(
"mktemp: invalid template, {}, contains directory separator\n",
r"a\XXX".quote()
));
}
/// Test that a suffix with a path separator is invalid.
#[test]
fn test_suffix_path_separator() {