test_mkdir: Add a test for non-Unicode directory name

Similar to the first part of GNU test df/problematic-chars.
This commit is contained in:
Nicolas Boichat
2025-07-22 17:25:59 +08:00
parent 7e6e9c291e
commit 64fb7a7462
+12
View File
@@ -34,6 +34,18 @@ fn test_mkdir_mkdir() {
new_ucmd!().arg("test_dir").succeeds();
}
#[cfg(feature = "test_risky_names")]
#[test]
fn test_mkdir_non_unicode() {
let (at, mut ucmd) = at_and_ucmd!();
let target = uucore::os_str_from_bytes(b"some-\xc0-dir-\xf3")
.expect("Only unix platforms can test non-unicode names");
ucmd.arg(&target).succeeds();
assert!(at.dir_exists(target));
}
#[test]
fn test_mkdir_verbose() {
let expected = "mkdir: created directory 'test_dir'\n";