Skip to content

Commit 64fb7a7

Browse files
committed
test_mkdir: Add a test for non-Unicode directory name
Similar to the first part of GNU test df/problematic-chars.
1 parent 7e6e9c2 commit 64fb7a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/by-util/test_mkdir.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ fn test_mkdir_mkdir() {
3434
new_ucmd!().arg("test_dir").succeeds();
3535
}
3636

37+
#[cfg(feature = "test_risky_names")]
38+
#[test]
39+
fn test_mkdir_non_unicode() {
40+
let (at, mut ucmd) = at_and_ucmd!();
41+
42+
let target = uucore::os_str_from_bytes(b"some-\xc0-dir-\xf3")
43+
.expect("Only unix platforms can test non-unicode names");
44+
ucmd.arg(&target).succeeds();
45+
46+
assert!(at.dir_exists(target));
47+
}
48+
3749
#[test]
3850
fn test_mkdir_verbose() {
3951
let expected = "mkdir: created directory 'test_dir'\n";

0 commit comments

Comments
 (0)