Skip to content

Commit

Permalink
tests/system.rs Now correctly identifies apple clang
Browse files Browse the repository at this point in the history
Previous regex didn't have proper capture group names, and the
regex didn't properly handle for spaces between `Apple` and
`clang version`. Updated to also support compiler output
like `Apple LLVM clang version` which I believe it used to do.
  • Loading branch information
robertmaynard committed Oct 18, 2023
1 parent 8253364 commit 480a442
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ fn run_sccache_command_tests(compiler: Compiler, tempdir: &Path) {
Err(e) => panic!("Invalid UTF-8 sequence: {}", e),
};

// Apple clang would match "Apple LLVM version"
let re = Regex::new(r"(?P<apply>Apple+*)?clang version (?P<major>\d+)").unwrap();
// Regex to match "Apple LLVM clang version" or "Apple clang version"
let re = Regex::new(r"(?P<apple>Apple)?.*clang version (?P<major>\d+)").unwrap();
let (major, is_appleclang) = match re.captures(version_output) {
Some(c) => (
c.name("major").unwrap().as_str().parse::<usize>().unwrap(),
Expand Down

0 comments on commit 480a442

Please sign in to comment.