From 7aa59ea643254b4961eaaa81f339b144e305df54 Mon Sep 17 00:00:00 2001 From: Iban Eguia Moraza Date: Sat, 5 Feb 2022 23:39:01 +0100 Subject: [PATCH] Added test for peeking issue --- boa/src/syntax/parser/cursor/buffered_lexer/tests.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/boa/src/syntax/parser/cursor/buffered_lexer/tests.rs b/boa/src/syntax/parser/cursor/buffered_lexer/tests.rs index 57e0fd53dcd..b2a301736d9 100644 --- a/boa/src/syntax/parser/cursor/buffered_lexer/tests.rs +++ b/boa/src/syntax/parser/cursor/buffered_lexer/tests.rs @@ -278,3 +278,11 @@ fn skip_peeked_terminators() { // End of stream assert!(cur.peek(2, true, &mut interner).unwrap().is_none()); } + +#[test] +fn issue_1768() { + let mut cur = BufferedLexer::from(&b"\n(\nx\n)\n"[..]); + let mut interner = Interner::default(); + + assert!(cur.peek(3, true, &mut interner).unwrap().is_none()); +}