From a440f768370677d19f885233af5acb6f8117f773 Mon Sep 17 00:00:00 2001 From: ituxbag Date: Thu, 1 Sep 2016 15:07:07 +0200 Subject: [PATCH 1/3] Fixed too sure .unwrap in tokenizer.rs --- tests/foreach_html5lib_test/mod.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/foreach_html5lib_test/mod.rs b/tests/foreach_html5lib_test/mod.rs index 7769a101..300c9d92 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(e) => { + println!("{}", e); } } } From 5bde586597322e0d8a497492bdcce310d1f87634 Mon Sep 17 00:00:00 2001 From: ituxbag Date: Thu, 1 Sep 2016 15:51:21 +0200 Subject: [PATCH 2/3] Revert old mechanism --- tests/foreach_html5lib_test/mod.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/foreach_html5lib_test/mod.rs b/tests/foreach_html5lib_test/mod.rs index 300c9d92..7769a101 100644 --- a/tests/foreach_html5lib_test/mod.rs +++ b/tests/foreach_html5lib_test/mod.rs @@ -23,19 +23,12 @@ pub fn foreach_html5lib_test( test_dir_path.push("html5lib-tests"); test_dir_path.push(subdir); - 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(e) => { - println!("{}", e); + 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); } } } From ee636e154bfcdda8c125497897347cffbe160b88 Mon Sep 17 00:00:00 2001 From: ituxbag Date: Thu, 1 Sep 2016 16:11:36 +0200 Subject: [PATCH 3/3] Display a message if html5lib-tests is empty --- tests/foreach_html5lib_test/mod.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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."); } } }