Skip to content

Commit ee636e1

Browse files
committed
Display a message if html5lib-tests is empty
1 parent 5bde586 commit ee636e1

File tree

1 file changed

+13
-6
lines changed
  • tests/foreach_html5lib_test

1 file changed

+13
-6
lines changed

tests/foreach_html5lib_test/mod.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ pub fn foreach_html5lib_test<Mk>(
2323
test_dir_path.push("html5lib-tests");
2424
test_dir_path.push(subdir);
2525

26-
let test_files = fs::read_dir(&test_dir_path).unwrap();
27-
for entry in test_files {
28-
let path = entry.unwrap().path();
29-
if path.extension() == Some(ext) {
30-
let file = fs::File::open(&path).unwrap();
31-
mk(&path, file);
26+
let maybe_test_files = fs::read_dir(&test_dir_path);
27+
match maybe_test_files {
28+
Ok(test_files) => {
29+
for entry in test_files {
30+
let path = entry.unwrap().path();
31+
if path.extension() == Some(ext) {
32+
let file = fs::File::open(&path).unwrap();
33+
mk(&path, file);
34+
}
35+
}
36+
},
37+
Err(_) => {
38+
panic!("Before launching the tests, please run this command:\n\n\tgit submodule update --init\n\nto retrieve an html5lib-tests snapshot.");
3239
}
3340
}
3441
}

0 commit comments

Comments
 (0)