blob: 59a2b363460a6035c7a105f08c236f9f4a94351a [file] [log] [blame]
import { shouldThrow, shouldNotThrow } from "./resources/assert.js";
shouldThrow(() => {
new Function(`import.meta`);
}, `SyntaxError: import.meta is only valid inside modules.`);
shouldNotThrow(() => {
checkModuleSyntax(`import.meta`);
});
shouldThrow(() => {
checkModuleSyntax(`(import.cocoa)`);
}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only be followed with meta.:1`);
shouldThrow(() => {
checkModuleSyntax(`(import["Cocoa"])`);
}, `SyntaxError: Unexpected token '['. import call expects exactly one argument.:1`);
shouldThrow(() => {
checkModuleSyntax(`import.cocoa`);
}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only be followed with meta.:1`);
shouldThrow(() => {
checkModuleSyntax(`import["Cocoa"]`);
}, `SyntaxError: Unexpected token '['. Expected namespace import or import list.:1`);