@@ -467,6 +467,43 @@ fn test_up_to_match_offset_option_suppress_matched() {
467467 assert_eq ! ( at. read( "xx01" ) , generate( 14 , 51 ) ) ;
468468}
469469
470+ #[ test]
471+ fn test_line_number_after_match_suppressed ( ) {
472+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
473+ ucmd. args ( & [ "numbers50.txt" , "--suppress-matched" , "/10/" , "9" ] )
474+ . succeeds ( )
475+ . stdout_only ( "18\n 0\n 117\n " ) ;
476+
477+ let count = glob ( & at. plus_as_string ( "xx*" ) )
478+ . expect ( "there should be splits created" )
479+ . count ( ) ;
480+ assert_eq ! ( count, 3 ) ;
481+ assert_eq ! ( at. read( "xx00" ) , generate( 1 , 10 ) ) ;
482+ assert_eq ! ( at. read( "xx01" ) , "" ) ;
483+
484+ // The 9 has suppressed line 11
485+ assert_eq ! ( at. read( "xx02" ) , generate( 12 , 51 ) ) ;
486+ }
487+
488+ #[ test]
489+ fn test_same_number_suppressed ( ) {
490+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
491+ ucmd. args ( & [ "numbers50.txt" , "--suppress-matched" , "5" , "5" , "5" ] )
492+ . succeeds ( )
493+ . stdout_only ( "8\n 0\n 0\n 127\n " ) ;
494+
495+ let count = glob ( & at. plus_as_string ( "xx*" ) )
496+ . expect ( "there should be splits created" )
497+ . count ( ) ;
498+ assert_eq ! ( count, 3 ) ;
499+ assert_eq ! ( at. read( "xx00" ) , generate( 1 , 5 ) ) ;
500+ assert_eq ! ( at. read( "xx01" ) , "" ) ;
501+ assert_eq ! ( at. read( "xx02" ) , "" ) ;
502+
503+ // The fives suppress lines 5, 6 and 7.
504+ assert_eq ! ( at. read( "xx02" ) , generate( 8 , 51 ) ) ;
505+ }
506+
470507#[ test]
471508fn test_up_to_match_negative_offset_option_suppress_matched ( ) {
472509 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
0 commit comments