File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ pub fn uu_app() -> Command {
6363}
6464
6565fn parse_cmd_args ( args : impl uucore:: Args ) -> UResult < ( Config , Format ) > {
66- let matches = uucore:: clap_localization:: handle_clap_result ( uu_app ( ) , args. collect_lossy ( ) ) ?;
66+ let matches = uucore:: clap_localization:: handle_clap_result ( uu_app ( ) , args) ?;
6767
6868 let encodings = get_encodings ( ) ;
6969 let format = encodings
Original file line number Diff line number Diff line change 55
66// spell-checker: ignore (encodings) lsbf msbf
77
8- use uutests:: new_ucmd;
8+ use uutests:: { at_and_ucmd , new_ucmd} ;
99
1010#[ test]
1111fn test_z85_not_padded_decode ( ) {
@@ -270,3 +270,31 @@ fn test_z85_length_check() {
270270 . succeeds ( )
271271 . stdout_only ( "12345678" ) ;
272272}
273+
274+ #[ test]
275+ fn test_file ( ) {
276+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
277+ let filename = "file" ;
278+
279+ at. write ( filename, "foo" ) ;
280+
281+ ucmd. arg ( filename)
282+ . arg ( "--base64" )
283+ . succeeds ( )
284+ . stdout_is ( "Zm9v\n " ) ;
285+ }
286+
287+ #[ test]
288+ #[ cfg( target_os = "linux" ) ]
289+ fn test_file_with_non_utf8_name ( ) {
290+ use std:: os:: unix:: ffi:: OsStringExt ;
291+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
292+
293+ let filename = std:: ffi:: OsString :: from_vec ( vec ! [ 0xFF , 0xFE ] ) ;
294+ std:: fs:: write ( at. plus ( & filename) , b"foo" ) . unwrap ( ) ;
295+
296+ ucmd. arg ( filename)
297+ . arg ( "--base64" )
298+ . succeeds ( )
299+ . stdout_is ( "Zm9v\n " ) ;
300+ }
You can’t perform that action at this time.
0 commit comments