Skip to content

Commit a2c58fc

Browse files
committed
Address review comments: simplify test path construction
1 parent f12239a commit a2c58fc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/by-util/test_sort.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,6 @@ fn test_files0_from_zero_length() {
15521552
fn test_files0_from_non_utf8_filename() {
15531553
use std::ffi::OsStr;
15541554
use std::os::unix::ffi::OsStrExt;
1555-
use std::path::Path;
15561555
let (at, mut ucmd) = at_and_ucmd!();
15571556

15581557
at.touch("file1.txt");
@@ -1561,15 +1560,15 @@ fn test_files0_from_non_utf8_filename() {
15611560
at.append("file2.txt", "apple\n");
15621561

15631562
// Create a file with non-UTF-8 bytes in filename
1564-
let non_utf8_name = OsStr::from_bytes(b"\xff\xfefile3.txt");
1565-
let non_utf8_path = at.plus_as_string("").to_owned() + "/";
1566-
let full_path = Path::new(&non_utf8_path).join(non_utf8_name);
1563+
// spell-checker:ignore fffile
1564+
let non_utf8_name = OsStr::from_bytes(b"\xff\xff_file3.txt");
1565+
let full_path = at.plus(non_utf8_name);
15671566
std::fs::write(&full_path, "banana\n").unwrap();
15681567

15691568
// Create files0-from input containing the non-UTF-8 filename bytes
15701569
let mut files0_input = Vec::new();
15711570
files0_input.extend_from_slice(b"file1.txt\0");
1572-
files0_input.extend_from_slice(b"\xff\xfefile3.txt\0");
1571+
files0_input.extend_from_slice(b"\xff\xff_file3.txt\0");
15731572
files0_input.extend_from_slice(b"file2.txt\0");
15741573

15751574
ucmd.args(&["--files0-from", "-"])

0 commit comments

Comments
 (0)