Index: test/mjsunit/harmony/module-parsing.js |
diff --git a/test/mjsunit/harmony/module-parsing.js b/test/mjsunit/harmony/module-parsing.js |
index 03948e31b9609f519378126582d9825d322206de..8a9103d13284ad4134192972276f7cd2c025538b 100644 |
--- a/test/mjsunit/harmony/module-parsing.js |
+++ b/test/mjsunit/harmony/module-parsing.js |
@@ -162,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); |