Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tooling/nargo_cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,22 @@ fn read_test_cases(
let test_case_dirs =
fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir());

test_case_dirs.into_iter().map(|dir| {
test_case_dirs.into_iter().filter_map(|dir| {
// When switching git branches we might end up with non-empty directories that have a `target`
// directory inside them but no `Nargo.toml`.
// These "tests" would always fail, but it's okay to ignore them so we do that here.
if !dir.path().join("Nargo.toml").exists() {
return None;
}

let test_name =
dir.file_name().into_string().expect("Directory can't be converted to string");
if test_name.contains('-') {
panic!(
"Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`"
);
}
(test_name, dir.path())
Some((test_name, dir.path()))
})
}

Expand Down