Skip to content

Commit

Permalink
Require a colon in //@ normalize-*: headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Jun 21, 2024
1 parent 7024c63 commit 0202259
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,13 +1315,11 @@ fn expand_variables(mut value: String, config: &Config) -> String {
/// normalize-*: "REGEX" -> "REPLACEMENT"
/// ```
fn parse_normalize_rule(header: &str) -> Option<(String, String)> {
// FIXME(#126370): A colon after the header name should be mandatory, but
// currently is not, and there are many tests that lack the colon.
// FIXME: Support escaped double-quotes in strings.
let captures = static_regex!(
r#"(?x) # (verbose mode regex)
^
[^:\s]+:?\s* # (header name followed by optional colon)
[^:\s]+:\s* # (header name followed by colon)
"(?<regex>[^"]*)" # "REGEX"
\s+->\s+ # ->
"(?<replacement>[^"]*)" # "REPLACEMENT"
Expand Down

0 comments on commit 0202259

Please sign in to comment.