@@ -873,3 +873,29 @@ fn parse_normalization_string(line: &mut &str) -> Option<String> {
873873 * line = & line[ end + 1 ..] ;
874874 Some ( result)
875875}
876+
877+ #[ test]
878+ fn test_parse_normalization_string ( ) {
879+ let mut s = "normalize-stderr-32bit: \" something (32 bits)\" -> \" something ($WORD bits)\" ." ;
880+ let first = parse_normalization_string ( & mut s) ;
881+ assert_eq ! ( first, Some ( "something (32 bits)" . to_owned( ) ) ) ;
882+ assert_eq ! ( s, " -> \" something ($WORD bits)\" ." ) ;
883+
884+ // Nothing to normalize (No quotes)
885+ let mut s = "normalize-stderr-32bit: something (32 bits) -> something ($WORD bits)." ;
886+ let first = parse_normalization_string ( & mut s) ;
887+ assert_eq ! ( first, None ) ;
888+ assert_eq ! ( s, r#"normalize-stderr-32bit: something (32 bits) -> something ($WORD bits)."# ) ;
889+
890+ // Nothing to normalize (Only a single quote)
891+ let mut s = "normalize-stderr-32bit: \" something (32 bits) -> something ($WORD bits)." ;
892+ let first = parse_normalization_string ( & mut s) ;
893+ assert_eq ! ( first, None ) ;
894+ assert_eq ! ( s, "normalize-stderr-32bit: \" something (32 bits) -> something ($WORD bits)." ) ;
895+
896+ // Nothing to normalize (Three quotes)
897+ let mut s = "normalize-stderr-32bit: \" something (32 bits)\" -> \" something ($WORD bits)." ;
898+ let first = parse_normalization_string ( & mut s) ;
899+ assert_eq ! ( first, Some ( "something (32 bits)" . to_owned( ) ) ) ;
900+ assert_eq ! ( s, " -> \" something ($WORD bits)." ) ;
901+ }
0 commit comments