@@ -642,3 +642,29 @@ fn parse_normalization_string(line: &mut &str) -> Option<String> {
642642 * line = & line[ end+1 ..] ;
643643 Some ( result)
644644}
645+
646+ #[ test]
647+ fn test_parse_normalization_string ( ) {
648+ let mut s = "normalize-stderr-32bit: \" something (32 bits)\" -> \" something ($WORD bits)\" ." ;
649+ let first = parse_normalization_string ( & mut s) ;
650+ assert_eq ! ( first, Some ( "something (32 bits)" . to_owned( ) ) ) ;
651+ assert_eq ! ( s, " -> \" something ($WORD bits)\" ." ) ;
652+
653+ // Nothing to normalize (No quotes)
654+ let mut s = "normalize-stderr-32bit: something (32 bits) -> something ($WORD bits)." ;
655+ let first = parse_normalization_string ( & mut s) ;
656+ assert_eq ! ( first, None ) ;
657+ assert_eq ! ( s, r#"normalize-stderr-32bit: something (32 bits) -> something ($WORD bits)."# ) ;
658+
659+ // Nothing to normalize (Only a single quote)
660+ let mut s = "normalize-stderr-32bit: \" something (32 bits) -> something ($WORD bits)." ;
661+ let first = parse_normalization_string ( & mut s) ;
662+ assert_eq ! ( first, None ) ;
663+ assert_eq ! ( s, "normalize-stderr-32bit: \" something (32 bits) -> something ($WORD bits)." ) ;
664+
665+ // Nothing to normalize (Three quotes)
666+ let mut s = "normalize-stderr-32bit: \" something (32 bits)\" -> \" something ($WORD bits)." ;
667+ let first = parse_normalization_string ( & mut s) ;
668+ assert_eq ! ( first, Some ( "something (32 bits)" . to_owned( ) ) ) ;
669+ assert_eq ! ( s, " -> \" something ($WORD bits)." ) ;
670+ }
0 commit comments