summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js')
-rw-r--r--src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js b/src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js
index cdd0a2e..8a9103d 100644
--- a/src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js
+++ b/src/3rdparty/v8/test/mjsunit/harmony/module-parsing.js
@@ -116,6 +116,11 @@ x
,
y
+var
+x
+,
+y
+
export
var
v1 = 1
@@ -157,3 +162,29 @@ try {} catch (module) {}
module
v = 20
+
+
+
+// Check that module declarations are rejected in eval or local scope.
+
+module M { export let x; }
+
+assertThrows("export x;", SyntaxError); // It's using eval, so should throw.
+assertThrows("export let x;", SyntaxError);
+assertThrows("import x from M;", SyntaxError);
+assertThrows("module M {};", SyntaxError);
+
+assertThrows("{ export x; }", SyntaxError);
+assertThrows("{ export let x; }", SyntaxError);
+assertThrows("{ import x from M; }", SyntaxError);
+assertThrows("{ module M {}; }", SyntaxError);
+
+assertThrows("function f() { export x; }", SyntaxError);
+assertThrows("function f() { export let x; }", SyntaxError);
+assertThrows("function f() { import x from M; }", SyntaxError);
+assertThrows("function f() { module M {}; }", SyntaxError);
+
+assertThrows("function f() { { export x; } }", SyntaxError);
+assertThrows("function f() { { export let x; } }", SyntaxError);
+assertThrows("function f() { { import x from M; } }", SyntaxError);
+assertThrows("function f() { { module M {}; } }", SyntaxError);