ladybird/Userland/Libraries/LibJS/Tests/syntax/dynamic-import-usage.js
davidot e179cf2540 LibJS: Don't VERIFY that the token after 'import' is one of '.' and '('
Although those are the only valid options parse_primary_expression is
sometimes called when only an expression is valid which means it did not
check match_expression and might fail the now removed VERIFY.
2021-12-29 16:57:23 +01:00

18 lines
613 B
JavaScript

describe("parsing", () => {
test("can parse call import call", () => {
expect("import('a')").toEval();
expect("import('a', )").toEval();
expect("import('a', {options: true})").toEval();
});
test("does not crash on unexpected tokens after import", () => {
expect("f = import('a')").toEval();
expect("f= import").not.toEval();
expect("f= import;").not.toEval();
expect("f= import?").not.toEval();
expect("f= import'").not.toEval();
expect("f= import 'a'").not.toEval();
expect("f= import['a']").not.toEval();
});
});