| 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 30 matching lines...) Expand all Loading... |
| 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: false, 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 // TODO(neis): Spec currently says the next one should return true. | |
| 52 assertFalse(Reflect.deleteProperty(foo, Symbol.toStringTag)); | 51 assertFalse(Reflect.deleteProperty(foo, Symbol.toStringTag)); |
| 52 assertEquals( |
| 53 {value: "Module", configurable: false, writable: false, enumerable: false}, |
| 54 Reflect.getOwnPropertyDescriptor(foo, Symbol.toStringTag)); |
| 53 | 55 |
| 54 // Nonexistant properties. | 56 // Nonexistant properties. |
| 55 let nonexistant = ["gaga", 123, Symbol('')]; | 57 let nonexistant = ["gaga", 123, Symbol('')]; |
| 56 for (let key of nonexistant) { | 58 for (let key of nonexistant) { |
| 57 assertSame(undefined, Reflect.getOwnPropertyDescriptor(foo, key)); | 59 assertSame(undefined, Reflect.getOwnPropertyDescriptor(foo, key)); |
| 58 assertTrue(Reflect.deleteProperty(foo, key)); | 60 assertTrue(Reflect.deleteProperty(foo, key)); |
| 59 assertFalse(Reflect.set(foo, key, true)); | 61 assertFalse(Reflect.set(foo, key, true)); |
| 60 assertSame(undefined, Reflect.get(foo, key)); | 62 assertSame(undefined, Reflect.get(foo, key)); |
| 61 assertFalse(Reflect.defineProperty(foo, key, {get() {return 1}})); | 63 assertFalse(Reflect.defineProperty(foo, key, {get() {return 1}})); |
| 62 assertFalse(Reflect.has(foo, key)); | 64 assertFalse(Reflect.has(foo, key)); |
| 63 } | 65 } |
| 64 | 66 |
| 65 // The actual star import that we are testing. Namespace imports are | 67 // The actual star import that we are testing. Namespace imports are |
| 66 // initialized before evaluation. | 68 // initialized before evaluation. |
| 67 import * as foo from "modules-namespace1.js"; | 69 import * as foo from "modules-namespace1.js"; |
| 68 | 70 |
| 69 // There can be only one namespace object. | 71 // There can be only one namespace object. |
| 70 import * as bar from "modules-namespace1.js"; | 72 import * as bar from "modules-namespace1.js"; |
| 71 assertSame(foo, bar); | 73 assertSame(foo, bar); |
| OLD | NEW |