@@ -492,7 +492,10 @@ fn parse_op_rx(opstr: &str, delim: char) -> io::Result<Operand> {
492492fn parse_op_repeat ( opstr : & str ) -> io:: Result < Operand > {
493493 // Must match pattern: {num} or {*}
494494 if !opstr. starts_with ( '{' ) || !opstr. ends_with ( '}' ) {
495- return Err ( Error :: new ( ErrorKind :: Other , "invalid repeating operand" ) ) ;
495+ return Err ( Error :: new (
496+ ErrorKind :: Other ,
497+ "invalid repeat operand: expected {num} or {*}" ,
498+ ) ) ;
496499 }
497500
498501 let inner = & opstr[ 1 ..opstr. len ( ) - 1 ] ;
@@ -509,7 +512,10 @@ fn parse_op_repeat(opstr: &str) -> io::Result<Operand> {
509512 }
510513 }
511514
512- Err ( Error :: new ( ErrorKind :: Other , "invalid repeating operand" ) )
515+ Err ( Error :: new (
516+ ErrorKind :: Other ,
517+ "invalid repeat operand: expected {num} or {*}" ,
518+ ) )
513519}
514520
515521/// Parses a line number operand from a string.
@@ -778,7 +784,7 @@ mod tests {
778784 match parse_op_repeat ( opstr) {
779785 Err ( e) => {
780786 assert_eq ! ( e. kind( ) , ErrorKind :: Other ) ;
781- assert_eq ! ( e. to_string( ) , "invalid repeating operand" ) ;
787+ assert ! ( e. to_string( ) . starts_with ( "invalid repeat operand" ) ) ;
782788 }
783789 _ => panic ! ( "Expected Err" ) ,
784790 }
@@ -790,7 +796,7 @@ mod tests {
790796 match parse_op_repeat ( opstr) {
791797 Err ( e) => {
792798 assert_eq ! ( e. kind( ) , ErrorKind :: Other ) ;
793- assert_eq ! ( e. to_string( ) , "invalid repeating operand" ) ;
799+ assert ! ( e. to_string( ) . starts_with ( "invalid repeat operand" ) ) ;
794800 }
795801 _ => panic ! ( "Expected Err" ) ,
796802 }
0 commit comments