diff --git a/boa_tester/src/read.rs b/boa_tester/src/read.rs index 6c66333b057..14b070a0905 100644 --- a/boa_tester/src/read.rs +++ b/boa_tester/src/read.rs @@ -103,6 +103,15 @@ pub(super) fn read_harness(test262_path: &Path) -> io::Result { /// Reads a test suite in the given path. pub(super) fn read_suite(path: &Path) -> io::Result { + use once_cell::sync::Lazy; + use regex::Regex; + + /// Regular expression to retrieve the metadata of a test. + static FIXTURE_REGEX: Lazy = Lazy::new(|| { + Regex::new(r#".*_FIXTURE.js(on)?"#) + .expect("could not compile fixture retrieval regular expression") + }); + let name = path .file_name() .ok_or_else(|| { @@ -128,7 +137,7 @@ pub(super) fn read_suite(path: &Path) -> io::Result { if entry.file_type()?.is_dir() { suites.push(read_suite(entry.path().as_path())?); - } else if entry.file_name().to_string_lossy().ends_with("_FIXTURE.js") { + } else if FIXTURE_REGEX.is_match(&entry.file_name().to_string_lossy()) { continue; } else if IGNORED.contains_file(&entry.file_name().to_string_lossy()) { let mut test = Test::default(); @@ -165,13 +174,13 @@ pub(super) fn read_test(path: &Path) -> io::Result { })?; let content = fs::read_to_string(path)?; - let metadata = read_metadata(&content)?; + let metadata = read_metadata(&content, path)?; Ok(Test::new(name, content, metadata)) } /// Reads the metadata from the input test code. -fn read_metadata(code: &str) -> io::Result { +fn read_metadata(code: &str, test: &Path) -> io::Result { use once_cell::sync::Lazy; use regex::Regex; @@ -183,9 +192,19 @@ fn read_metadata(code: &str) -> io::Result { let yaml = META_REGEX .captures(code) - .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "no metadata found"))? + .ok_or_else(|| { + io::Error::new( + io::ErrorKind::InvalidData, + format!("no metadata found for test {}", test.display()), + ) + })? .get(1) - .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "no metadata found"))? + .ok_or_else(|| { + io::Error::new( + io::ErrorKind::InvalidData, + format!("no metadata found for test {}", test.display()), + ) + })? .as_str() .replace('\r', "\n"); diff --git a/boa_tester/src/results.rs b/boa_tester/src/results.rs index 25054611540..7aa65f7dc5f 100644 --- a/boa_tester/src/results.rs +++ b/boa_tester/src/results.rs @@ -428,15 +428,13 @@ fn compute_result_diff( .into_boxed_str(); match (base_test.result, new_test.result) { - (TestOutcomeResult::Passed, TestOutcomeResult::Passed) - | (TestOutcomeResult::Ignored, TestOutcomeResult::Ignored) - | (TestOutcomeResult::Failed, TestOutcomeResult::Failed) - | (TestOutcomeResult::Panic, TestOutcomeResult::Panic) => {} + (a, b) if a == b => {} (_, TestOutcomeResult::Passed) => final_diff.fixed.push(test_name), + (TestOutcomeResult::Panic, _) => final_diff.panic_fixes.push(test_name), (_, TestOutcomeResult::Failed) => final_diff.broken.push(test_name), (_, TestOutcomeResult::Panic) => final_diff.new_panics.push(test_name), - (TestOutcomeResult::Panic, _) => final_diff.panic_fixes.push(test_name), + _ => {} } } diff --git a/test262 b/test262 index d454b8389b0..e793512b55c 160000 --- a/test262 +++ b/test262 @@ -1 +1 @@ -Subproject commit d454b8389b07dae252c008adb64ae242b812c801 +Subproject commit e793512b55c199de6abc392d1be4de7325dae544