Skip to content

Commit db45b67

Browse files
committed
enable filtered test file execution
e.g. to execute all files containing 5250 TEST_FILE=5250 cargo test system
1 parent 18c0369 commit db45b67

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/test/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,15 @@ where
9090
}
9191

9292
fn is_file_skip(path: &Path) -> bool {
93-
SKIP_FILE_WHITE_LIST
94-
.iter()
95-
.any(|file_path| is_subpath(path, file_path))
93+
let filter_file = std::env::var("TEST_FILE").ok();
94+
let skip_file = filter_file
95+
.map(|filter_file| !path.to_str().unwrap().contains(&filter_file))
96+
.unwrap_or(false);
97+
98+
skip_file
99+
|| SKIP_FILE_WHITE_LIST
100+
.iter()
101+
.any(|file_path| is_subpath(path, file_path))
96102
}
97103

98104
// Returns a `Vec` containing `PathBuf`s of files with an `rs` extension in the

0 commit comments

Comments
 (0)