Skip to content

Truly independent web browser

805 B
Raw Blame
describe("parsing", () => {
    test("can parse call import call", () => {
        expect("import('a')").toEval();
        expect("import('a', )").toEval();
        expect("import('a', {options: true})").toEval();
    });

    test("parenthesized import call can be used as a new callee", () => {
        expect("new import('a')").not.toEval();
        expect("new (import('a'), function() {})").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();
    });
});