File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1469,3 +1469,31 @@ fn test_date_posix_format_specifiers() {
14691469 . stdout_is ( format ! ( "{expected}\n " ) ) ;
14701470 }
14711471}
1472+
1473+ /// Test that %x format specifier respects locale settings
1474+ /// This is a regression test for locale-aware date formatting
1475+ #[ test]
1476+ #[ ignore = "https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2137410" ]
1477+ #[ cfg( any( target_os = "linux" , target_vendor = "apple" ) ) ]
1478+ fn test_date_format_x_locale_aware ( ) {
1479+ // With C locale, %x should output MM/DD/YY (US format)
1480+ new_ucmd ! ( )
1481+ . env ( "TZ" , "UTC" )
1482+ . env ( "LC_ALL" , "C" )
1483+ . arg ( "-d" )
1484+ . arg ( "1997-01-19 08:17:48" )
1485+ . arg ( "+%x" )
1486+ . succeeds ( )
1487+ . stdout_is ( "01/19/97\n " ) ;
1488+
1489+ // With French locale, %x should output DD/MM/YYYY (European format)
1490+ // GNU date outputs: 19/01/1997
1491+ new_ucmd ! ( )
1492+ . env ( "TZ" , "UTC" )
1493+ . env ( "LC_ALL" , "fr_FR.UTF-8" )
1494+ . arg ( "-d" )
1495+ . arg ( "1997-01-19 08:17:48" )
1496+ . arg ( "+%x" )
1497+ . succeeds ( )
1498+ . stdout_is ( "19/01/1997\n " ) ;
1499+ }
You can’t perform that action at this time.
0 commit comments