From f6ce3528d0174664698d6f632c8108507ce6d61b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 18 Oct 2023 15:44:48 -0400 Subject: [PATCH] tests/system.rs Now correctly identifies apple clang (#1905) 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. --- tests/system.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system.rs b/tests/system.rs index 34e18f763..85ea94c0f 100644 --- a/tests/system.rs +++ b/tests/system.rs @@ -463,8 +463,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"(?PApple+*)?clang version (?P\d+)").unwrap(); + // Regex to match "Apple LLVM clang version" or "Apple clang version" + let re = Regex::new(r"(?PApple)?.*clang version (?P\d+)").unwrap(); let (major, is_appleclang) = match re.captures(version_output) { Some(c) => ( c.name("major").unwrap().as_str().parse::().unwrap(),