| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
import defer * as ns from "./dep_FIXTURE.js"; |
| 28 |
|
| 29 |
assert.sameValue(typeof ns, "object", "Deferred namespaces are objects"); |
| 30 |
|
| 31 |
assert(!Reflect.isExtensible(ns), "Deferred namespaces are not extensible"); |
| 32 |
assert.sameValue(Reflect.preventExtensions(ns), true, "Deferred namespaces can made non-extensible"); |
| 33 |
|
| 34 |
assert.sameValue(Reflect.getPrototypeOf(ns), null, "Deferred namespaces have a null prototype"); |
| 35 |
assert.sameValue(Reflect.setPrototypeOf(ns, {}), false, "Deferred namespaces' prototype cannot be changed"); |
| 36 |
assert.sameValue(Reflect.setPrototypeOf(ns, null), true, "Deferred namespaces' prototype can be 'set' to null"); |
| 37 |
|
| 38 |
assert.throws(TypeError, () => Reflect.apply(ns, null, []), "Deferred namespaces are not callable"); |
| 39 |
assert.throws(TypeError, () => Reflect.construct(ns, [], ns), "Deferred namespaces are not constructable"); |
| 40 |
|
| 41 |
assert.compareArray( |
| 42 |
Reflect.ownKeys(ns), |
| 43 |
["bar", "foo", Symbol.toStringTag], |
| 44 |
"Deferred namespaces' keys are the exports sorted alphabetically, followed by @@toStringTag" |
| 45 |
); |
| 46 |
|
| 47 |
|
| 48 |
const desc = Reflect.getOwnPropertyDescriptor(ns, "foo"); |
| 49 |
assert.sameValue(desc.value, 1, "The value of the 'foo' property is 1"); |
| 50 |
assert.sameValue(desc.writable, true, "The 'foo' property is writable"); |
| 51 |
assert.sameValue(desc.enumerable, true, "The 'foo' property is enumerable"); |
| 52 |
assert.sameValue(desc.configurable, false, "The 'foo' property is not configurable"); |
| 53 |
|
| 54 |
assert.sameValue(Reflect.getOwnPropertyDescriptor(ns, "non-existent"), undefined, "No descriptors for non-exports"); |
| 55 |
|
| 56 |
reportCompare(0, 0); |