Skip to content

Commit

Permalink
okay seriously don't reformat the whole test file
Browse files Browse the repository at this point in the history
  • Loading branch information
addisoncrump committed Feb 23, 2022
1 parent 8c92a8f commit 9a274d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 6 additions & 5 deletions boa_engine/src/bytecompiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1480,11 +1480,12 @@ impl<'b> ByteCompiler<'b> {
break;
}
}
assert!(
found,
"Undefined label '{}'",
self.interner().resolve_expect(label_name)
);
if !found {
return self.context.throw_syntax_error(format!(
"Undefined label '{}'",
self.interner().resolve_expect(label_name)
));
}
} else {
self.jump_info
.last_mut()
Expand Down
5 changes: 2 additions & 3 deletions boa_engine/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,14 @@ fn for_loop_iteration_variable_does_not_leak() {
}

#[test]
#[should_panic]
fn test_invalid_break_target() {
let src = r#"
while (false) {
while (true) {
break nonexistent;
}
"#;

let _ = &exec(src);
assert!(matches!(Context::default().eval(src.as_bytes()), Err(_)));
}

#[test]
Expand Down

0 comments on commit 9a274d9

Please sign in to comment.