Skip to content

Commit

Permalink
Merge pull request #368 from EEJDempster/disabled_testing
Browse files Browse the repository at this point in the history
To fix issue #354 (allowing disabled integration tests to be run)
  • Loading branch information
ozgurakgun authored Oct 14, 2024
2 parents 82e12d3 + 199a0e4 commit be389f3
Showing 1 changed file with 72 additions and 34 deletions.
106 changes: 72 additions & 34 deletions conjure_oxide/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,81 @@ fn main() -> io::Result<()> {
for subdir in WalkDir::new(test_dir) {
let subdir = subdir?;
if subdir.file_type().is_dir() {
let stems: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry
.path()
.extension()
.map_or(false, |ext| ext == "essence" || ext == "eprime")
})
.filter_map(|entry| {
entry
.path()
.file_stem()
.and_then(|stem| stem.to_str())
.map(|s| s.to_owned())
})
.collect();
if std::env::var("ALLTEST").is_ok() {
let stems: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry.path().extension().map_or(false, |ext| {
ext == "essence" || ext == "eprime" || ext == "disabled"
})
})
.filter_map(|entry| {
entry
.path()
.file_stem()
.and_then(|stem| stem.to_str())
.map(|s| s.to_owned())
})
.collect();

let exts: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry
.path()
.extension()
.map_or(false, |ext| ext == "essence" || ext == "eprime")
})
.filter_map(|entry| {
entry
.path()
.extension()
.and_then(|ext| ext.to_str())
.map(|s| s.to_owned())
})
.collect();
let exts: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry.path().extension().map_or(false, |ext| {
ext == "essence" || ext == "eprime" || ext == "disabled"
})
})
.filter_map(|entry| {
entry
.path()
.extension()
.and_then(|ext| ext.to_str())
.map(|s| s.to_owned())
})
.collect();

let essence_files = std::iter::zip(stems, exts).collect();
let essence_files = std::iter::zip(stems, exts).collect();

write_test(&mut f, subdir.path().display().to_string(), essence_files)?;
write_test(&mut f, subdir.path().display().to_string(), essence_files)?;
} else {
let stems: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry
.path()
.extension()
.map_or(false, |ext| ext == "essence" || ext == "eprime")
})
.filter_map(|entry| {
entry
.path()
.file_stem()
.and_then(|stem| stem.to_str())
.map(|s| s.to_owned())
})
.collect();

let exts: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry
.path()
.extension()
.map_or(false, |ext| ext == "essence" || ext == "eprime")
})
.filter_map(|entry| {
entry
.path()
.extension()
.and_then(|ext| ext.to_str())
.map(|s| s.to_owned())
})
.collect();

let essence_files = std::iter::zip(stems, exts).collect();

write_test(&mut f, subdir.path().display().to_string(), essence_files)?;
}
}
}

Expand Down

0 comments on commit be389f3

Please sign in to comment.