OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // MODULE | 5 // MODULE |
6 | 6 |
7 let ja = 42; | 7 let ja = 42; |
8 export {ja as yo}; | 8 export {ja as yo}; |
9 export const bla = "blaa"; | 9 export const bla = "blaa"; |
10 export {foo as foo_again}; | 10 export {foo as foo_again}; |
(...skipping 28 matching lines...) Expand all Loading... |
39 assertEquals(42, Reflect.get(foo, "yo")); | 39 assertEquals(42, Reflect.get(foo, "yo")); |
40 assertEquals(43, (ja++, foo.yo)); | 40 assertEquals(43, (ja++, foo.yo)); |
41 | 41 |
42 // Its "foo_again" property. | 42 // Its "foo_again" property. |
43 assertSame(foo, foo.foo_again); | 43 assertSame(foo, foo.foo_again); |
44 | 44 |
45 // Its @@toStringTag property. | 45 // Its @@toStringTag property. |
46 assertTrue(Reflect.has(foo, Symbol.toStringTag)); | 46 assertTrue(Reflect.has(foo, Symbol.toStringTag)); |
47 assertEquals("string", typeof Reflect.get(foo, Symbol.toStringTag)); | 47 assertEquals("string", typeof Reflect.get(foo, Symbol.toStringTag)); |
48 assertEquals( | 48 assertEquals( |
49 {value: "Module", configurable: true, writable: false, enumerable: false}, | 49 {value: "Module", configurable: false, writable: false, enumerable: false}, |
50 Reflect.getOwnPropertyDescriptor(foo, Symbol.toStringTag)); | 50 Reflect.getOwnPropertyDescriptor(foo, Symbol.toStringTag)); |
51 | 51 // TODO(neis): Spec currently says the next one should return true. |
52 // TODO(neis): Clarify spec w.r.t. other symbols. | 52 assertFalse(Reflect.deleteProperty(foo, Symbol.toStringTag)); |
53 | 53 |
54 // Nonexistant properties. | 54 // Nonexistant properties. |
55 let nonexistant = ["gaga", 123, Symbol('')]; | 55 let nonexistant = ["gaga", 123, Symbol('')]; |
56 for (let key of nonexistant) { | 56 for (let key of nonexistant) { |
57 assertSame(undefined, Reflect.getOwnPropertyDescriptor(foo, key)); | 57 assertSame(undefined, Reflect.getOwnPropertyDescriptor(foo, key)); |
58 assertTrue(Reflect.deleteProperty(foo, key)); | 58 assertTrue(Reflect.deleteProperty(foo, key)); |
59 assertFalse(Reflect.set(foo, key, true)); | 59 assertFalse(Reflect.set(foo, key, true)); |
60 assertSame(undefined, Reflect.get(foo, key)); | 60 assertSame(undefined, Reflect.get(foo, key)); |
61 assertFalse(Reflect.defineProperty(foo, key, {get() {return 1}})); | 61 assertFalse(Reflect.defineProperty(foo, key, {get() {return 1}})); |
62 assertFalse(Reflect.has(foo, key)); | 62 assertFalse(Reflect.has(foo, key)); |
63 } | 63 } |
64 | 64 |
65 // The actual star import that we are testing. Namespace imports are | 65 // The actual star import that we are testing. Namespace imports are |
66 // initialized before evaluation. | 66 // initialized before evaluation. |
67 import * as foo from "modules-namespace1.js"; | 67 import * as foo from "modules-namespace1.js"; |
68 | 68 |
69 // There can be only one namespace object. | 69 // There can be only one namespace object. |
70 import * as bar from "modules-namespace1.js"; | 70 import * as bar from "modules-namespace1.js"; |
71 assertSame(foo, bar); | 71 assertSame(foo, bar); |
OLD | NEW |