Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Unified Diff: test/mjsunit/modules/export2.js

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/modules/export2.js
diff --git a/test/mjsunit/modules/export2.js b/test/mjsunit/modules/export2.js
new file mode 100644
index 0000000000000000000000000000000000000000..b23a98148d0addff9ea8813c92cd08d0b8c89739
--- /dev/null
+++ b/test/mjsunit/modules/export2.js
@@ -0,0 +1,31 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// MODULE
+
+export function foo() { return 42 }
+assertEquals(42, foo());
+foo = 1;
+assertEquals(1, foo);
+
+let gaga = 43;
+export {gaga as gugu};
+assertEquals(43, gaga);
+
+export default (function bar() { return 43 })
+assertThrows(() => bar(), ReferenceError);
+assertThrows("default", SyntaxError);
+assertThrows("*default*", SyntaxError);
+
+
+var shit = 44;
+var shiit = 45;
+export {shit};
+export {shit as shiit};
+export {shit as shiiit};
+assertEquals(44, shit);
+assertEquals(45, shiit);
+shit = 46;
+assertEquals(46, shit);
+assertEquals(45, shiit);

Powered by Google App Engine
This is Rietveld 408576698