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:
parent
74e0071cfe
commit
2e9e984b3a
2 changed files with 27 additions and 0 deletions
|
@ -438,6 +438,7 @@ fn test_zeros_to_file() {
|
||||||
let tname = "zero-256k";
|
let tname = "zero-256k";
|
||||||
let test_fn = format!("{}.txt", tname);
|
let test_fn = format!("{}.txt", tname);
|
||||||
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
|
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
|
||||||
|
assert_fixture_exists!(test_fn);
|
||||||
|
|
||||||
let (fix, mut ucmd) = at_and_ucmd!();
|
let (fix, mut ucmd) = at_and_ucmd!();
|
||||||
ucmd.args(&["status=none", inf!(test_fn), of!(tmp_fn)])
|
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 tname = "zero-256k";
|
||||||
let test_fn = format!("{}.txt", tname);
|
let test_fn = format!("{}.txt", tname);
|
||||||
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
|
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
|
||||||
|
assert_fixture_exists!(test_fn);
|
||||||
|
|
||||||
let (fix, mut ucmd) = at_and_ucmd!();
|
let (fix, mut ucmd) = at_and_ucmd!();
|
||||||
ucmd.args(&[
|
ucmd.args(&[
|
||||||
|
@ -529,6 +531,7 @@ fn test_ascii_5_gibi_to_file() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_transfer() {
|
fn test_self_transfer() {
|
||||||
let fname = "self-transfer-256k.txt";
|
let fname = "self-transfer-256k.txt";
|
||||||
|
assert_fixture_exists!(fname);
|
||||||
|
|
||||||
let (fix, mut ucmd) = at_and_ucmd!();
|
let (fix, mut ucmd) = at_and_ucmd!();
|
||||||
ucmd.args(&["status=none", "conv=notrunc", inf!(fname), of!(fname)]);
|
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());
|
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
|
// conv=[ascii,ebcdic,ibm], conv=[ucase,lcase], conv=[block,unblock], conv=sync
|
||||||
// TODO: Move conv tests from unit test module
|
// TODO: Move conv tests from unit test module
|
||||||
|
|
0
tests/fixtures/dd/😎💚🦊.txt
vendored
Normal file
0
tests/fixtures/dd/😎💚🦊.txt
vendored
Normal file
Loading…
Add table
Add a link
Reference in a new issue