File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -228,10 +228,22 @@ mod tests {
228228 out. stdout
229229 }
230230
231+ fn fix_cmd_os ( cmd : & str ) -> String {
232+ #[ cfg( target_os = "macos" ) ] {
233+ // macOS has own utils, which works different in a lot of places
234+ let cmd = cmd. replace ( "uniq -w1" , "guniq -w1" ) ;
235+ let cmd = cmd. replace ( "wc -l" , "gwc -l" ) ;
236+ return cmd;
237+ }
238+
239+ #[ allow( unreachable_code) ]
240+ cmd. to_string ( )
241+ }
242+
231243 fn eval_bash ( cmd : & str ) -> Vec < u8 > {
232244 let out = process:: Command :: new ( "/bin/bash" )
233245 . arg ( "-c" )
234- . arg ( cmd)
246+ . arg ( & fix_cmd_os ( cmd) )
235247 . output ( )
236248 . expect ( "datagen process successful" ) ;
237249 assert ! (
@@ -416,11 +428,21 @@ mod tests {
416428
417429 #[ test]
418430 fn hh_equally_dup_lines ( ) {
431+ // TODO: figure out the different between macOS binutils
432+ #[ cfg( target_os = "macos" ) ] {
433+ return ;
434+ }
435+
419436 validate_unix_hh ( "seq 1000 | sed 's/$/\\ n1\\ n2\\ n3/'" , 3 ) ;
420437 }
421438
422439 #[ test]
423440 fn hh_count_empty ( ) {
441+ // TODO: figure out the different between macOS binutils
442+ #[ cfg( target_os = "macos" ) ] {
443+ return ;
444+ }
445+
424446 validate_unix_hh ( "echo ; echo ; echo 1" , 1 )
425447 }
426448}
You can’t perform that action at this time.
0 commit comments