1
Fork 0

compiletest: Move static_regex! into compiletest::util

This commit is contained in:
Zalathar 2024-06-11 15:37:43 +10:00
parent 8337ba9189
commit c9d880bf01
3 changed files with 11 additions and 10 deletions

View file

@ -15,7 +15,7 @@ use crate::errors::{self, Error, ErrorKind};
use crate::header::TestProps;
use crate::json;
use crate::read2::{read2_abbreviated, Truncated};
use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, PathBufExt};
use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, static_regex, PathBufExt};
use crate::ColorConfig;
use colored::Colorize;
use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
@ -48,14 +48,6 @@ use debugger::DebuggerCommands;
#[cfg(test)]
mod tests;
macro_rules! static_regex {
($re:literal) => {{
static RE: ::std::sync::OnceLock<::regex::Regex> = ::std::sync::OnceLock::new();
RE.get_or_init(|| ::regex::Regex::new($re).unwrap())
}};
}
use static_regex;
const FAKE_SRC_BASE: &str = "fake-test-src-base";
#[cfg(windows)]

View file

@ -7,7 +7,8 @@ use std::process::Command;
use glob::glob;
use crate::common::{UI_COVERAGE, UI_COVERAGE_MAP};
use crate::runtest::{static_regex, Emit, ProcRes, TestCx, WillExecute};
use crate::runtest::{Emit, ProcRes, TestCx, WillExecute};
use crate::util::static_regex;
impl<'test> TestCx<'test> {
fn coverage_dump_path(&self) -> &Path {

View file

@ -90,3 +90,11 @@ pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Re
}
Ok(())
}
macro_rules! static_regex {
($re:literal) => {{
static RE: ::std::sync::OnceLock<::regex::Regex> = ::std::sync::OnceLock::new();
RE.get_or_init(|| ::regex::Regex::new($re).unwrap())
}};
}
pub(crate) use static_regex;