File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1851,6 +1851,25 @@ fn test_files0_from_2a() {
18511851 . stdout_only ( "a\n a\n " ) ;
18521852}
18531853
1854+ #[ test]
1855+ // Test for GNU tests/sort/sort-files0-from.pl "non-utf8"
1856+ #[ cfg( unix) ]
1857+ fn test_files0_from_non_utf8 ( ) {
1858+ use std:: os:: unix:: ffi:: OsStringExt ;
1859+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
1860+
1861+ // non-UTF-8 bytes (0xFF)
1862+ let filename = std:: ffi:: OsString :: from_vec ( vec ! [ b'a' , 0xFF , b'b' ] ) ;
1863+ std:: fs:: write ( at. plus ( & filename) , b"20\n 10\n " ) . unwrap ( ) ;
1864+
1865+ let list_contents = vec ! [ b'a' , 0xFF , b'b' , 0 ] ;
1866+ at. write_bytes ( "list0" , & list_contents) ;
1867+
1868+ ucmd. args ( & [ "--files0-from" , "list0" ] )
1869+ . succeeds ( )
1870+ . stdout_only ( "10\n 20\n " ) ;
1871+ }
1872+
18541873#[ test]
18551874// Test for GNU tests/sort/sort-files0-from.pl "zero-len"
18561875fn test_files0_from_zero_length ( ) {
You can’t perform that action at this time.
0 commit comments