@@ -1366,6 +1366,101 @@ fn test_null_byte_input_multiline() {
13661366 . stdout_is ( "1000\n 3000" ) ;
13671367}
13681368
1369+ // https://github.com/uutils/coreutils/issues/11653
1370+ // GNU rejects `-9923868` as an invalid short option (leading `-9`) and
1371+ // requires `--` separator; uutils accepts it as a negative positional number.
1372+ #[ test]
1373+ #[ ignore = "GNU compat: see uutils/coreutils#11653" ]
1374+ fn test_negative_number_without_double_dash_gnu_compat_issue_11653 ( ) {
1375+ new_ucmd ! ( )
1376+ . args ( & [ "--to=iec" , "-9923868" ] )
1377+ . fails_with_code ( 1 )
1378+ . stderr_contains ( "invalid option" ) ;
1379+ }
1380+
1381+ // https://github.com/uutils/coreutils/issues/11654
1382+ // uutils parses large integers through f64, losing precision past 2^53.
1383+ #[ test]
1384+ #[ ignore = "GNU compat: see uutils/coreutils#11654" ]
1385+ fn test_large_integer_precision_loss_issue_11654 ( ) {
1386+ new_ucmd ! ( )
1387+ . args ( & [ "--from=iec" , "9153396227555392131" ] )
1388+ . succeeds ( )
1389+ . stdout_is ( "9153396227555392131\n " ) ;
1390+ }
1391+
1392+ // https://github.com/uutils/coreutils/issues/11655
1393+ // uutils accepts scientific notation (`1e9`, `5e-3`, ...); GNU rejects it
1394+ // as "invalid suffix in input".
1395+ #[ test]
1396+ #[ ignore = "GNU compat: see uutils/coreutils#11655" ]
1397+ fn test_scientific_notation_rejected_by_gnu_issue_11655 ( ) {
1398+ new_ucmd ! ( )
1399+ . arg ( "1e9" )
1400+ . fails_with_code ( 2 )
1401+ . stderr_contains ( "invalid suffix in input" ) ;
1402+ }
1403+
1404+ // https://github.com/uutils/coreutils/issues/11662
1405+ // `--to=auto` is accepted at parse time by uutils then rejected at runtime
1406+ // with exit code 2; GNU rejects it in option parsing with exit code 1.
1407+ #[ test]
1408+ #[ ignore = "GNU compat: see uutils/coreutils#11662" ]
1409+ fn test_to_auto_rejected_at_parse_time_issue_11662 ( ) {
1410+ new_ucmd ! ( )
1411+ . args ( & [ "--to=auto" , "100" ] )
1412+ . fails_with_code ( 1 )
1413+ . stderr_contains ( "invalid argument 'auto' for '--to'" ) ;
1414+ }
1415+
1416+ // https://github.com/uutils/coreutils/issues/11663
1417+ // `--from-unit` multiplication with fractional input rounds to an integer;
1418+ // GNU preserves the fractional digits.
1419+ #[ test]
1420+ #[ ignore = "GNU compat: see uutils/coreutils#11663" ]
1421+ fn test_from_unit_fractional_precision_issue_11663 ( ) {
1422+ new_ucmd ! ( )
1423+ . args ( & [ "--from=iec" , "--from-unit=959" , "--" , "-615484.454" ] )
1424+ . succeeds ( )
1425+ . stdout_is ( "-590249591.386\n " ) ;
1426+ }
1427+
1428+ // https://github.com/uutils/coreutils/issues/11664
1429+ // Zero-padded `--format` places padding zeros before the sign for negative
1430+ // numbers; GNU (and C printf) puts the sign first.
1431+ #[ test]
1432+ #[ ignore = "GNU compat: see uutils/coreutils#11664" ]
1433+ fn test_zero_pad_sign_order_issue_11664 ( ) {
1434+ new_ucmd ! ( )
1435+ . args ( & [ "--from=none" , "--format=%018.2f" , "--" , "-9869647" ] )
1436+ . succeeds ( )
1437+ . stdout_is ( "-00000009869647.00\n " ) ;
1438+ }
1439+
1440+ // https://github.com/uutils/coreutils/issues/11666
1441+ // `--to-unit=N` selects the output prefix based on the unscaled value
1442+ // instead of `value / N`.
1443+ #[ test]
1444+ #[ ignore = "GNU compat: see uutils/coreutils#11666" ]
1445+ fn test_to_unit_prefix_selection_issue_11666 ( ) {
1446+ new_ucmd ! ( )
1447+ . args ( & [ "--to=iec-i" , "--to-unit=885" , "100000" ] )
1448+ . succeeds ( )
1449+ . stdout_is ( "113\n " ) ;
1450+ }
1451+
1452+ // https://github.com/uutils/coreutils/issues/11667
1453+ // `--format='%.0f'` with `--to=<scale>` still prints one fractional digit;
1454+ // the precision specifier `.0` is ignored.
1455+ #[ test]
1456+ #[ ignore = "GNU compat: see uutils/coreutils#11667" ]
1457+ fn test_format_precision_zero_with_to_scale_issue_11667 ( ) {
1458+ new_ucmd ! ( )
1459+ . args ( & [ "--to=iec" , "--format=%.0f" , "5183776" ] )
1460+ . succeeds ( )
1461+ . stdout_is ( "5M\n " ) ;
1462+ }
1463+
13691464#[ test]
13701465fn test_invalid_utf8_input ( ) {
13711466 // 0xFF is invalid UTF-8
0 commit comments