Skip to content

Commit

Permalink
Match any characters in multi-revision comment matchers
Browse files Browse the repository at this point in the history
Currently, the matcher `//[rev-foo,rev-bar]~` does not get selected by
the regex, nor does anything that includes whitespace

Change the regex matcher to be more flexible and capture anything within
the `[...]` brackets, and trim the result before testing.
  • Loading branch information
tgross35 committed Apr 18, 2024
1 parent 3412f01 commit 4b4673c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ fn parse_expected(
// //[rev1]~
// //[rev1,rev2]~^^
static RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r"//(?:\[(?P<revs>[\w,]+)])?~(?P<adjust>\||\^*)").unwrap());
Lazy::new(|| Regex::new(r"//(?:\[(?P<revs>.+)])?~(?P<adjust>\||\^*)").unwrap());

let captures = RE.captures(line)?;

match (test_revision, captures.name("revs")) {
// Only error messages that contain our revision between the square brackets apply to us.
(Some(test_revision), Some(revision_filters)) => {
if !revision_filters.as_str().split(',').any(|r| r == test_revision) {
if !revision_filters.as_str().split(',').map(str::trim).any(|r| r == test_revision) {
return None;
}
}
Expand Down

0 comments on commit 4b4673c

Please sign in to comment.