Skip to content

Commit

Permalink
fixed rust-fmt again and added parser test
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarthelmess committed Jul 14, 2022
1 parent e67b740 commit bbe1f50
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions boa_engine/src/syntax/lexer/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@ fn regex_equals_following_assignment() {
TokenKind::identifier(interner.get_or_intern_static("myRegex")),
TokenKind::Punctuator(Punctuator::Assign),
TokenKind::regular_expression_literal(
interner.get_or_intern_static("="),
Sym::EMPTY_STRING
interner.get_or_intern_static("="),
Sym::EMPTY_STRING,
),
TokenKind::Punctuator(Punctuator::Semicolon),
];
Expand Down
25 changes: 24 additions & 1 deletion boa_engine/src/syntax/parser/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
},
Context,
};
use boa_interner::Interner;
use boa_interner::{Interner, Sym};

/// Checks that the given JavaScript string gives the expected expression.
#[allow(clippy::unwrap_used)]
Expand Down Expand Up @@ -78,6 +78,29 @@ fn assign_operator_precedence() {
);
}

#[test]
fn assign_regex_equals() {
let mut interner = Interner::default();
check_parser(
"let myRegex = /=/;",
vec![DeclarationList::Let(
vec![Declaration::new_with_identifier(
interner.get_or_intern_static("myRegex"),
Node::from(New::from(Call::new(
Identifier::new(Sym::REGEXP),
vec![
Node::from(Const::from(interner.get_or_intern_static("="))),
Node::from(Const::from(Sym::EMPTY_STRING)),
],
))),
)]
.into(),
)
.into()],
interner,
);
}

#[test]
fn hoisting() {
let mut interner = Interner::default();
Expand Down

0 comments on commit bbe1f50

Please sign in to comment.