aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/modules-namespace1.mjs
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-16 11:32:46 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-19 09:25:23 +0200
commite31f0a7d25668d3c1531294d2ef44a9f3bde4ef4 (patch)
tree6c6bed9804be9df6162b2483f0a56f371f66464d /deps/v8/test/mjsunit/modules-namespace1.mjs
parentec16fdae540adaf710b1a86c620170b2880088f0 (diff)
downloadandroid-node-v8-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.tar.gz
android-node-v8-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.tar.bz2
android-node-v8-e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4.zip
deps: update V8 to 7.7.299.4
PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/v8/test/mjsunit/modules-namespace1.mjs')
-rw-r--r--deps/v8/test/mjsunit/modules-namespace1.mjs71
1 files changed, 71 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/modules-namespace1.mjs b/deps/v8/test/mjsunit/modules-namespace1.mjs
new file mode 100644
index 0000000000..8087e8315a
--- /dev/null
+++ b/deps/v8/test/mjsunit/modules-namespace1.mjs
@@ -0,0 +1,71 @@
+// 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.
+
+let ja = 42;
+export {ja as yo};
+export const bla = "blaa";
+export {foo as foo_again};
+// See further below for the actual star import that declares "foo".
+
+// The object itself.
+assertEquals("object", typeof foo);
+assertThrows(() => foo = 666, TypeError);
+assertFalse(Reflect.isExtensible(foo));
+assertTrue(Reflect.preventExtensions(foo));
+assertThrows(() => Reflect.apply(foo, {}, []));
+assertThrows(() => Reflect.construct(foo, {}, []));
+assertSame(null, Reflect.getPrototypeOf(foo));
+assertTrue(Reflect.setPrototypeOf(foo, null));
+assertFalse(Reflect.setPrototypeOf(foo, {}));
+assertSame(null, Reflect.getPrototypeOf(foo));
+assertEquals(
+ ["bla", "foo_again", "yo", Symbol.toStringTag], Reflect.ownKeys(foo));
+
+// Its "yo" property.
+assertEquals(
+ {value: 42, enumerable: true, configurable: false, writable: true},
+ Reflect.getOwnPropertyDescriptor(foo, "yo"));
+assertFalse(Reflect.deleteProperty(foo, "yo"));
+assertTrue(Reflect.has(foo, "yo"));
+assertFalse(Reflect.set(foo, "yo", true));
+// TODO(neis): The next two should be False.
+assertTrue(Reflect.defineProperty(foo, "yo",
+ Reflect.getOwnPropertyDescriptor(foo, "yo")));
+assertTrue(Reflect.defineProperty(foo, "yo", {}));
+assertFalse(Reflect.defineProperty(foo, "yo", {get() {return 1}}));
+assertEquals(42, Reflect.get(foo, "yo"));
+assertEquals(43, (ja++, foo.yo));
+
+// Its "foo_again" property.
+assertSame(foo, foo.foo_again);
+
+// Its @@toStringTag property.
+assertTrue(Reflect.has(foo, Symbol.toStringTag));
+assertEquals("string", typeof Reflect.get(foo, Symbol.toStringTag));
+assertEquals(
+ {value: "Module", configurable: false, writable: false, enumerable: false},
+ Reflect.getOwnPropertyDescriptor(foo, Symbol.toStringTag));
+assertFalse(Reflect.deleteProperty(foo, Symbol.toStringTag));
+assertEquals(
+ {value: "Module", configurable: false, writable: false, enumerable: false},
+ Reflect.getOwnPropertyDescriptor(foo, Symbol.toStringTag));
+
+// Nonexistent properties.
+let nonexistent = ["gaga", 123, Symbol('')];
+for (let key of nonexistent) {
+ assertSame(undefined, Reflect.getOwnPropertyDescriptor(foo, key));
+ assertTrue(Reflect.deleteProperty(foo, key));
+ assertFalse(Reflect.set(foo, key, true));
+ assertSame(undefined, Reflect.get(foo, key));
+ assertFalse(Reflect.defineProperty(foo, key, {get() {return 1}}));
+ assertFalse(Reflect.has(foo, key));
+}
+
+// The actual star import that we are testing. Namespace imports are
+// initialized before evaluation.
+import * as foo from "modules-namespace1.mjs";
+
+// There can be only one namespace object.
+import * as bar from "modules-namespace1.mjs";
+assertSame(foo, bar);