@@ -11,10 +11,12 @@ fn test_invalid_arg() {
1111 new_ucmd ! ( ) . arg ( "--definitely-invalid" ) . fails_with_code ( 1 ) ;
1212}
1313
14+ // This test failed when fixing #11653.
15+ // Add a `--` separator to ensure floats are not rounded(it match the gnu pattern).
1416#[ test]
1517fn test_should_not_round_floats ( ) {
1618 new_ucmd ! ( )
17- . args ( & [ "0.99" , "1.01" , "1.1" , "1.22" , ".1" , "-0.1" ] )
19+ . args ( & [ "--" , " 0.99", "1.01" , "1.1" , "1.22" , ".1" , "-0.1" ] )
1820 . succeeds ( )
1921 . stdout_is ( "0.99\n 1.01\n 1.1\n 1.22\n 0.1\n -0.1\n " ) ;
2022}
@@ -1370,12 +1372,22 @@ fn test_null_byte_input_multiline() {
13701372// GNU rejects `-9923868` as an invalid short option (leading `-9`) and
13711373// requires `--` separator; uutils accepts it as a negative positional number.
13721374#[ test]
1373- #[ ignore = "GNU compat: see uutils/coreutils#11653" ]
13741375fn test_negative_number_without_double_dash_gnu_compat_issue_11653 ( ) {
13751376 new_ucmd ! ( )
13761377 . args ( & [ "--to=iec" , "-9923868" ] )
13771378 . fails_with_code ( 1 )
1378- . stderr_contains ( "invalid option" ) ;
1379+ . stderr_contains ( "unexpected argument" ) ;
1380+ }
1381+
1382+ // https://github.com/uutils/coreutils/issues/11653
1383+ // GNU rejects `-9923868` as an invalid short option (leading `-9`) and
1384+ // requires `--` separator; uutils accepts it as a negative positional number.
1385+ #[ test]
1386+ fn test_negative_number_with_double_dash_gnu_compat_issue_11653 ( ) {
1387+ new_ucmd ! ( )
1388+ . args ( & [ "--to=iec" , "--" , "-9923868" ] )
1389+ . succeeds ( )
1390+ . stdout_is ( "-9.5M\n " ) ;
13791391}
13801392
13811393// https://github.com/uutils/coreutils/issues/11654
0 commit comments