diff --git a/tests/foreach_html5lib_test/mod.rs b/tests/foreach_html5lib_test/mod.rs
index 7769a101..ad4dc622 100644
--- a/tests/foreach_html5lib_test/mod.rs
+++ b/tests/foreach_html5lib_test/mod.rs
@@ -23,12 +23,19 @@ pub fn foreach_html5lib_test(
test_dir_path.push("html5lib-tests");
test_dir_path.push(subdir);
- let test_files = fs::read_dir(&test_dir_path).unwrap();
- for entry in test_files {
- let path = entry.unwrap().path();
- if path.extension() == Some(ext) {
- let file = fs::File::open(&path).unwrap();
- mk(&path, file);
+ let maybe_test_files = fs::read_dir(&test_dir_path);
+ match maybe_test_files {
+ Ok(test_files) => {
+ for entry in test_files {
+ let path = entry.unwrap().path();
+ if path.extension() == Some(ext) {
+ let file = fs::File::open(&path).unwrap();
+ mk(&path, file);
+ }
+ }
+ },
+ Err(_) => {
+ panic!("Before launching the tests, please run this command:\n\n\tgit submodule update --init\n\nto retrieve an html5lib-tests snapshot.");
}
}
}