Skip to content

Commit

Permalink
Compile StatementList after parse passes on negative tests (#1906)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
raskad committed Mar 8, 2022
1 parent 44b5617 commit 7f90829
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions boa_tester/src/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,13 @@ impl Test {
self.name
);

let mut interner = Interner::default();
match Parser::new(self.content.as_bytes(), strict).parse_all(&mut interner) {
Ok(n) => (false, format!("{n:?}")),
let mut context = Context::default();
context.set_strict_mode(strict);
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}")),
}
}
Expand Down

0 comments on commit 7f90829

Please sign in to comment.