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}; |
11 // See further below for the actual star import that declares "foo". | 11 // See further below for the actual star import that declares "foo". |
12 | 12 |
13 // The object itself. | 13 // The object itself. |
14 assertEquals("object", typeof foo); | 14 assertEquals("object", typeof foo); |
15 assertThrows(() => foo = 666, TypeError); | 15 assertThrows(() => foo = 666, TypeError); |
16 assertFalse(Reflect.isExtensible(foo)); | 16 assertFalse(Reflect.isExtensible(foo)); |
17 assertTrue(Reflect.preventExtensions(foo)); | 17 assertTrue(Reflect.preventExtensions(foo)); |
18 assertThrows(() => Reflect.apply(foo, {}, [])); | 18 assertThrows(() => Reflect.apply(foo, {}, [])); |
19 assertThrows(() => Reflect.construct(foo, {}, [])); | 19 assertThrows(() => Reflect.construct(foo, {}, [])); |
20 assertSame(null, Reflect.getPrototypeOf(foo)); | 20 assertSame(null, Reflect.getPrototypeOf(foo)); |
21 // TODO(neis): The next one should be False. | |
22 assertTrue(Reflect.setPrototypeOf(foo, null)); | 21 assertTrue(Reflect.setPrototypeOf(foo, null)); |
23 assertFalse(Reflect.setPrototypeOf(foo, {})); | 22 assertFalse(Reflect.setPrototypeOf(foo, {})); |
24 assertSame(null, Reflect.getPrototypeOf(foo)); | 23 assertSame(null, Reflect.getPrototypeOf(foo)); |
25 assertEquals( | 24 assertEquals( |
26 ["bla", "foo_again", "yo", Symbol.toStringTag, Symbol.iterator], | 25 ["bla", "foo_again", "yo", Symbol.toStringTag, Symbol.iterator], |
27 Reflect.ownKeys(foo)); | 26 Reflect.ownKeys(foo)); |
28 | 27 |
29 // Its "yo" property. | 28 // Its "yo" property. |
30 assertEquals( | 29 assertEquals( |
31 {value: 42, enumerable: true, configurable: false, writable: true}, | 30 {value: 42, enumerable: true, configurable: false, writable: true}, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 assertFalse(Reflect.has(foo, key)); | 97 assertFalse(Reflect.has(foo, key)); |
99 } | 98 } |
100 | 99 |
101 // The actual star import that we are testing. Namespace imports are | 100 // The actual star import that we are testing. Namespace imports are |
102 // initialized before evaluation. | 101 // initialized before evaluation. |
103 import * as foo from "modules-namespace1.js"; | 102 import * as foo from "modules-namespace1.js"; |
104 | 103 |
105 // There can be only one namespace object. | 104 // There can be only one namespace object. |
106 import * as bar from "modules-namespace1.js"; | 105 import * as bar from "modules-namespace1.js"; |
107 assertSame(foo, bar); | 106 assertSame(foo, bar); |
OLD | NEW |