Skip to content

Commit

Permalink
Expectations struct for output-type-permutations
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 4, 2024
1 parent da50aae commit 2bb1be2
Show file tree
Hide file tree
Showing 2 changed files with 448 additions and 194 deletions.
10 changes: 6 additions & 4 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ pub fn test_while_readonly<P: AsRef<Path>, F: FnOnce() + std::panic::UnwindSafe>
#[track_caller]
pub fn shallow_find_files<P: AsRef<Path>, F: Fn(&PathBuf) -> bool>(
path: P,
closure: F,
filter: F,
) -> Vec<PathBuf> {
let mut matching_files = Vec::new();
for entry in fs_wrapper::read_dir(path) {
let entry = entry.expect("failed to read directory entry.");
let path = entry.path();

if path.is_file() && closure(&path) {
if path.is_file() && filter(&path) {
matching_files.push(path);
}
}
Expand All @@ -291,8 +291,10 @@ pub fn has_extension<P: AsRef<Path>>(path: P, extension: &str) -> bool {
}

/// Returns true if the filename at `path` is not in `expected`.
pub fn name_not_among<P: AsRef<Path>>(path: P, expected: &[&'static str]) -> bool {
path.as_ref().file_name().is_some_and(|name| !expected.contains(&name.to_str().unwrap()))
pub fn filename_not_in_denylist<P: AsRef<Path>>(path: P, expected: &[String]) -> bool {
path.as_ref()
.file_name()
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
}

/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
Expand Down
Loading

0 comments on commit 2bb1be2

Please sign in to comment.