Skip to content

Commit 5cbab61

Browse files
refactor(xtask/cts): move TEST_LINE_REGEX to single site of use
1 parent 5e6c151 commit 5cbab61

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

xtask/src/cts.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ const CTS_GIT_URL: &str = "https://github.com/gpuweb/cts.git";
5050
/// Path to default CTS test list.
5151
const CTS_DEFAULT_TEST_LIST: &str = "cts_runner/test.lst";
5252

53-
static TEST_LINE_REGEX: LazyLock<Regex> = LazyLock::new(|| {
54-
RegexBuilder::new(r#"(?:fails-if\s*\(\s*(?<fails_if>\w+)\s*\)\s+)?(?<selector>.*)"#)
55-
.build()
56-
.unwrap()
57-
});
58-
5953
#[derive(Default)]
6054
struct TestLine {
6155
pub selector: OsString,
@@ -103,6 +97,12 @@ pub fn run_cts(
10397

10498
for file in list_files {
10599
tests.extend(shell.read_file(file)?.lines().filter_map(|line| {
100+
static TEST_LINE_REGEX: LazyLock<Regex> = LazyLock::new(|| {
101+
RegexBuilder::new(r#"(?:fails-if\s*\(\s*(?<fails_if>\w+)\s*\)\s+)?(?<selector>.*)"#)
102+
.build()
103+
.unwrap()
104+
});
105+
106106
let trimmed = line.trim();
107107
let is_comment = trimmed.starts_with("//") || trimmed.starts_with("#");
108108
let captures = TEST_LINE_REGEX

0 commit comments

Comments
 (0)