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

Adds test with unicode filename

Filenames should be the only spot where unicode can appear in dd's cli.
This commit is contained in:
Tyler 2021-07-06 18:17:30 -07:00
parent 74e0071cfe
commit 2e9e984b3a
2 changed files with 27 additions and 0 deletions

View file

@ -438,6 +438,7 @@ fn test_zeros_to_file() {
let tname = "zero-256k";
let test_fn = format!("{}.txt", tname);
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
assert_fixture_exists!(test_fn);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&["status=none", inf!(test_fn), of!(tmp_fn)])
@ -457,6 +458,7 @@ fn test_to_file_with_ibs_obs() {
let tname = "zero-256k";
let test_fn = format!("{}.txt", tname);
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
assert_fixture_exists!(test_fn);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&[
@ -529,6 +531,7 @@ fn test_ascii_5_gibi_to_file() {
#[test]
fn test_self_transfer() {
let fname = "self-transfer-256k.txt";
assert_fixture_exists!(fname);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&["status=none", "conv=notrunc", inf!(fname), of!(fname)]);
@ -542,5 +545,29 @@ fn test_self_transfer() {
assert_eq!(256 * 1024, fix.metadata(fname).len());
}
#[test]
fn test_unicode_filenames() {
let tname = "😎💚🦊";
let test_fn = format!("{}.txt", tname);
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
assert_fixture_exists!(test_fn);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&[
"status=none",
inf!(test_fn),
of!(tmp_fn),
])
.run()
.no_stderr()
.no_stdout()
.success();
cmp_file!(
File::open(fixture_path!(&test_fn)).unwrap(),
fix.open(&tmp_fn)
);
}
// conv=[ascii,ebcdic,ibm], conv=[ucase,lcase], conv=[block,unblock], conv=sync
// TODO: Move conv tests from unit test module

0
tests/fixtures/dd/😎💚🦊.txt vendored Normal file
View file