From 7800d33c525124da0e9e3298119636a714399d95 Mon Sep 17 00:00:00 2001 From: Kunam Balaram Reddy Date: Sun, 21 Apr 2024 09:04:27 +0530 Subject: [PATCH] fix errors and tests --- Cargo.lock | 40 +++++++++++++++++++++++++++------------- Cargo.toml | 3 +-- src/runner.rs | 2 +- tests/example.rs | 4 ++-- tests/files/{a => a.txt} | 0 tests/files/{b => b.txt} | 0 tests/files/c.skip.txt | 1 + 7 files changed, 32 insertions(+), 18 deletions(-) rename tests/files/{a => a.txt} (100%) rename tests/files/{b => b.txt} (100%) create mode 100644 tests/files/c.skip.txt 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 75c9dde41..1f54614c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,10 +13,9 @@ rust-version = "1.65" [dependencies] camino = "1.1.6" +fancy-regex = "0.13.0" libtest-mimic = "0.7.2" -regex = "1.10.4" walkdir = "2.5.0" -fancy_regex = "0.13.0" [[test]] name = "example" diff --git a/src/runner.rs b/src/runner.rs index 721e23230..79cd7330d 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -58,7 +58,7 @@ impl Requirements { 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(|_| panic!("Problem with matching following pattern : '{}'", self.pattern)) { 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..dc8964ab7 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"^.*(?