Browse Source

Compile StatementList after parse passes on negative tests (#1906)

This fixes an issue with 262 negative tests, that should produce a syntax errors. Currently we only parse the test code is such cases. If the parsing does not return an error, we do not compile the code further. This caused some panics. Most of them are fixed by now, the last ones will be fixed with #1860.
pull/1913/head
raskad 3 years ago
parent
commit
7f90829f88
  1. 10
      boa_tester/src/exec/mod.rs

10
boa_tester/src/exec/mod.rs

@ -180,9 +180,13 @@ impl Test {
self.name self.name
); );
let mut interner = Interner::default(); let mut context = Context::default();
match Parser::new(self.content.as_bytes(), strict).parse_all(&mut interner) { context.set_strict_mode(strict);
Ok(n) => (false, format!("{n:?}")), match context.parse(self.content.as_bytes()) {
Ok(statement_list) => match context.compile(&statement_list) {
Ok(_) => (false, "StatementList compilation should fail".to_owned()),
Err(e) => (true, format!("Uncaught {e:?}")),
},
Err(e) => (true, format!("Uncaught {e}")), Err(e) => (true, format!("Uncaught {e}")),
} }
} }

Loading…
Cancel
Save