@@ -1096,13 +1096,16 @@ fn test_ls_long() {
10961096 let at = & scene. fixtures ;
10971097 at. touch ( at. plus_as_string ( "test-long" ) ) ;
10981098
1099+ #[ cfg( not( windows) ) ]
1100+ let regex = r"[-bcCdDlMnpPsStTx?]([r-][w-][xt-]){3}.*" ;
1101+ #[ cfg( windows) ]
1102+ let regex = r"[-dl](r[w-]x){3}.*" ;
1103+
1104+ let re = & Regex :: new ( regex) . unwrap ( ) ;
1105+
10991106 for arg in LONG_ARGS {
11001107 let result = scene. ucmd ( ) . arg ( arg) . arg ( "test-long" ) . succeeds ( ) ;
1101- #[ cfg( not( windows) ) ]
1102- result. stdout_matches ( & Regex :: new ( r"[-bcCdDlMnpPsStTx?]([r-][w-][xt-]){3}.*" ) . unwrap ( ) ) ;
1103-
1104- #[ cfg( windows) ]
1105- result. stdout_matches ( & Regex :: new ( r"[-dl](r[w-]x){3}.*" ) . unwrap ( ) ) ;
1108+ result. stdout_matches ( re) ;
11061109 }
11071110}
11081111
@@ -1115,23 +1118,30 @@ fn test_ls_long_format() {
11151118 at. touch ( at. plus_as_string ( "test-long-dir/test-long-file" ) ) ;
11161119 at. mkdir ( at. plus_as_string ( "test-long-dir/test-long-dir" ) ) ;
11171120
1118- for arg in LONG_ARGS {
1119- // Assuming sane username do not have spaces within them.
1120- // A line of the output should be:
1121- // One of the characters -bcCdDlMnpPsStTx?
1122- // rwx, with - for missing permissions, thrice.
1123- // Zero or one "." for indicating a file with security context
1124- // A number, preceded by column whitespace, and followed by a single space.
1125- // A username, currently [^ ], followed by column whitespace, twice (or thrice for Hurd).
1126- // A number, followed by a single space.
1127- // A month, followed by a single space.
1128- // A day, preceded by column whitespace, and followed by a single space.
1129- // Either a year or a time, currently [0-9:]+, preceded by column whitespace,
1130- // and followed by a single space.
1131- // Whatever comes after is irrelevant to this specific test.
1132- scene. ucmd ( ) . arg ( arg) . arg ( "test-long-dir" ) . succeeds ( ) . stdout_matches ( & Regex :: new (
1121+ // Assuming sane username do not have spaces within them.
1122+ // A line of the output should be:
1123+ // One of the characters -bcCdDlMnpPsStTx?
1124+ // rwx, with - for missing permissions, thrice.
1125+ // Zero or one "." for indicating a file with security context
1126+ // A number, preceded by column whitespace, and followed by a single space.
1127+ // A username, currently [^ ], followed by column whitespace, twice (or thrice for Hurd).
1128+ // A number, followed by a single space.
1129+ // A month, followed by a single space.
1130+ // A day, preceded by column whitespace, and followed by a single space.
1131+ // Either a year or a time, currently [0-9:]+, preceded by column whitespace,
1132+ // and followed by a single space.
1133+ // Whatever comes after is irrelevant to this specific test.
1134+ let re = & Regex :: new (
11331135 r"\n[-bcCdDlMnpPsStTx?]([r-][w-][xt-]){3}\.? +\d+ [^ ]+ +[^ ]+( +[^ ]+)? +\d+ [A-Z][a-z]{2} {0,2}\d{0,2} {0,2}[0-9:]+ "
1134- ) . unwrap ( ) ) ;
1136+ ) . unwrap ( ) ;
1137+
1138+ for arg in LONG_ARGS {
1139+ scene
1140+ . ucmd ( )
1141+ . arg ( arg)
1142+ . arg ( "test-long-dir" )
1143+ . succeeds ( )
1144+ . stdout_matches ( re) ;
11351145 }
11361146
11371147 // This checks for the line with the .. entry. The uname and group should be digits.
0 commit comments