diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 268a45c5a..4ac7269e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,8 +57,7 @@ jobs: matrix: os: - ubuntu-latest - # 1.65 is the MSRV - rust-version: ["1.65", stable] + rust-version: ["1.66", stable] fail-fast: false steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 diff --git a/Cargo.lock b/Cargo.lock index cd89b5fa8..f752e5df6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,6 +60,21 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "camino" version = "1.1.6" @@ -118,8 +133,8 @@ name = "datatest-stable" version = "0.2.6" dependencies = [ "camino", + "fancy-regex", "libtest-mimic", - "regex", "walkdir", ] @@ -132,6 +147,17 @@ dependencies = [ "rustversion", ] +[[package]] +name = "fancy-regex" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + [[package]] name = "heck" version = "0.4.1" @@ -213,18 +239,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "regex" -version = "1.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - [[package]] name = "regex-automata" version = "0.4.6" diff --git a/Cargo.toml b/Cargo.toml index 10bd25854..4df086fa4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,12 +9,12 @@ readme = "README.md" edition = "2021" categories = ["development-tools::testing"] keywords = ["datatest", "data-driven-tests", "test-harness"] -rust-version = "1.65" +rust-version = "1.66" [dependencies] camino = "1.1.6" +fancy-regex = "0.13.0" libtest-mimic = "0.7.2" -regex = "1.10.4" walkdir = "2.5.0" [[test]] diff --git a/src/runner.rs b/src/runner.rs index ad1417d9f..1582cf0bb 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -52,13 +52,20 @@ impl Requirements { /// Scans all files in a given directory, finds matching ones and generates a test descriptor /// for each of them. fn expand(&self) -> Vec { - let re = regex::Regex::new(&self.pattern) + let re = fancy_regex::Regex::new(&self.pattern) .unwrap_or_else(|_| panic!("invalid regular expression: '{}'", self.pattern)); let tests: Vec<_> = utils::iterate_directory(&self.root) .filter_map(|path_res| { let path = path_res.expect("error while iterating directory"); - if re.is_match(path.as_str()) { + if re.is_match(path.as_str()).unwrap_or_else(|error| { + panic!( + "error matching pattern '{}' against path '{}' : {}", + self.pattern, + path.as_str(), + error + ) + }) { let testfn = self.test; let name = utils::derive_test_name(&self.root, &path, &self.test_name); Some(Trial::test(name, move || { diff --git a/tests/example.rs b/tests/example.rs index d814faaac..13ff47f18 100644 --- a/tests/example.rs +++ b/tests/example.rs @@ -20,8 +20,8 @@ fn test_artifact_utf8(path: &Utf8Path) -> Result<()> { datatest_stable::harness!( test_artifact, "tests/files", - r"^.*/*", + r"^.*(?