@@ -3723,6 +3723,57 @@ fn test_ls_quoting_style_arg_overrides_env_var() {
37233723 }
37243724}
37253725
3726+ #[ test]
3727+ fn test_ls_quoting_style_locale ( ) {
3728+ let scene = TestScenario :: new ( util_name ! ( ) ) ;
3729+ let at = & scene. fixtures ;
3730+ at. touch ( "file with spaces.txt" ) ;
3731+
3732+ // Test different locale-specific quote characters
3733+ // Each locale should use appropriate quotation marks for that language
3734+ let test_cases = vec ! [
3735+ // English - ASCII double quotes
3736+ ( "en_US.UTF-8" , "\" file with spaces.txt\" " ) ,
3737+ // French - Guillemets (U+00AB, U+00BB)
3738+ ( "fr_FR.UTF-8" , "«file with spaces.txt»" ) ,
3739+ // German - Low-9 and high quotes (U+201E, U+201C)
3740+ ( "de_DE.UTF-8" , "„file with spaces.txt“" ) ,
3741+ // Japanese - Corner brackets (U+300C, U+300D)
3742+ ( "ja_JP.UTF-8" , "「file with spaces.txt」" ) ,
3743+ // Chinese - CJK curly quotes (U+201C, U+201D)
3744+ ( "zh_CN.UTF-8" , "“file with spaces.txt”" ) ,
3745+ // Russian - Guillemets (U+00AB, U+00BB)
3746+ ( "ru_RU.UTF-8" , "«file with spaces.txt»" ) ,
3747+ // Spanish - Guillemets (U+00AB, U+00BB)
3748+ ( "es_ES.UTF-8" , "«file with spaces.txt»" ) ,
3749+ // Polish - Low-9 double quotes (U+201E, U+201D)
3750+ ( "pl_PL.UTF-8" , "„file with spaces.txt”" ) ,
3751+ // Default/unset locale - ASCII double quotes
3752+ ( "C" , "\" file with spaces.txt\" " ) ,
3753+ ( "POSIX" , "\" file with spaces.txt\" " ) ,
3754+ ] ;
3755+
3756+ for ( locale, expected_output) in test_cases {
3757+ scene
3758+ . ucmd ( )
3759+ . env ( "LC_ALL" , locale)
3760+ . arg ( "--quoting-style=locale" )
3761+ . arg ( "file with spaces.txt" )
3762+ . succeeds ( )
3763+ . stdout_only ( format ! ( "{expected_output}\n " ) ) ;
3764+ }
3765+
3766+ // Test escape sequences work with locale quoting
3767+ at. touch ( "newline\n file" ) ;
3768+ scene
3769+ . ucmd ( )
3770+ . env ( "LC_ALL" , "fr_FR.UTF-8" )
3771+ . arg ( "--quoting-style=locale" )
3772+ . arg ( "newline\n file" )
3773+ . succeeds ( )
3774+ . stdout_only ( "«newline\\ nfile»\n " ) ;
3775+ }
3776+
37263777#[ test]
37273778fn test_ls_quoting_and_color ( ) {
37283779 let scene = TestScenario :: new ( util_name ! ( ) ) ;
0 commit comments