mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Add tests for module namespace objects
Assert correct behavior of the own properties of module namespace objects and the essential internal methods of module namespace exotic objects.
This commit is contained in:
parent
3cb20b9df5
commit
3dc6d92970
@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: Length of @@iterator method
|
||||
info: >
|
||||
ES6 Section 17:
|
||||
Every built-in Function object, including constructors, has a length
|
||||
property whose value is an integer. Unless otherwise specified, this value
|
||||
is equal to the largest number of named arguments shown in the subclause
|
||||
headings for the function description, including optional parameters.
|
||||
|
||||
[...]
|
||||
|
||||
Unless otherwise specified, the length property of a built-in Function
|
||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||
[[Configurable]]: true }.
|
||||
flags: [module]
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
import * as ns from './length.js';
|
||||
|
||||
assert.sameValue(ns[Symbol.iterator].length, 0);
|
||||
|
||||
verifyNotEnumerable(ns[Symbol.iterator], 'length');
|
||||
verifyNotWritable(ns[Symbol.iterator], 'length');
|
||||
verifyConfigurable(ns[Symbol.iterator], 'length');
|
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: Length of List iterator returned by @@iterator method
|
||||
info: >
|
||||
ES6 Section 17:
|
||||
Every built-in Function object, including constructors, has a length
|
||||
property whose value is an integer. Unless otherwise specified, this value
|
||||
is equal to the largest number of named arguments shown in the subclause
|
||||
headings for the function description, including optional parameters.
|
||||
|
||||
[...]
|
||||
|
||||
Unless otherwise specified, the length property of a built-in Function
|
||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||
[[Configurable]]: true }.
|
||||
flags: [module]
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
import * as ns from './list-iter-next-length.js';
|
||||
|
||||
var next = ns[Symbol.iterator]().next;
|
||||
|
||||
assert.sameValue(next.length, 0);
|
||||
|
||||
verifyNotEnumerable(next, 'length');
|
||||
verifyNotWritable(next, 'length');
|
||||
verifyConfigurable(next, 'length');
|
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: >
|
||||
Descriptor for `name` property of ListIterator returned by @@iterator
|
||||
method
|
||||
info: >
|
||||
The value of the name property of this function is "[Symbol.iterator]".
|
||||
|
||||
ES6 Section 17: ECMAScript Standard Built-in Objects
|
||||
|
||||
Every built-in Function object, including constructors, that is not
|
||||
identified as an anonymous function has a name property whose value is a
|
||||
String. Unless otherwise specified, this value is the name that is given to
|
||||
the function in this specification.
|
||||
|
||||
[...]
|
||||
|
||||
Unless otherwise specified, the name property of a built-in Function
|
||||
object, if it exists, has the attributes { [[Writable]]: false,
|
||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||
flags: [module]
|
||||
features: [Symbol.iterator]
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
import * as ns from './list-iter-next-name.js';
|
||||
|
||||
var next = ns[Symbol.iterator]().next;
|
||||
|
||||
assert.sameValue(next.name, 'next');
|
||||
|
||||
verifyNotEnumerable(next, 'name');
|
||||
verifyNotWritable(next, 'name');
|
||||
verifyConfigurable(next, 'name');
|
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: Property descriptor
|
||||
info: >
|
||||
ES6 Section 17
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex
|
||||
B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
flags: [module]
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
import * as ns from './list-iter-next-prop-desc.js';
|
||||
var iter = ns[Symbol.iterator]();
|
||||
|
||||
assert.sameValue(typeof iter.next, 'function');
|
||||
verifyNotEnumerable(iter, 'next');
|
||||
verifyWritable(iter, 'next');
|
||||
verifyConfigurable(iter, 'next');
|
33
test/language/module-code/namespace/Symbol.iterator/name.js
Normal file
33
test/language/module-code/namespace/Symbol.iterator/name.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: Descriptor for `name` property
|
||||
info: >
|
||||
The value of the name property of this function is "[Symbol.iterator]".
|
||||
|
||||
ES6 Section 17: ECMAScript Standard Built-in Objects
|
||||
|
||||
Every built-in Function object, including constructors, that is not
|
||||
identified as an anonymous function has a name property whose value is a
|
||||
String. Unless otherwise specified, this value is the name that is given to
|
||||
the function in this specification.
|
||||
|
||||
[...]
|
||||
|
||||
Unless otherwise specified, the name property of a built-in Function
|
||||
object, if it exists, has the attributes { [[Writable]]: false,
|
||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||
flags: [module]
|
||||
features: [Symbol.iterator]
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
import * as ns from './name.js';
|
||||
|
||||
assert.sameValue(ns[Symbol.iterator].name, '[Symbol.iterator]');
|
||||
|
||||
verifyNotEnumerable(ns[Symbol.iterator], 'name');
|
||||
verifyNotWritable(ns[Symbol.iterator], 'name');
|
||||
verifyConfigurable(ns[Symbol.iterator], 'name');
|
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: Property descriptor
|
||||
info: >
|
||||
ES6 Section 17
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex
|
||||
B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
flags: [module]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
import * as ns from './prop-desc.js';
|
||||
|
||||
assert.sameValue(typeof ns[Symbol.iterator], 'function');
|
||||
|
||||
// propertyHelper.js is not appropriate for this test because it assumes that
|
||||
// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
|
||||
// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
|
||||
// object does not.
|
||||
var desc = Object.getOwnPropertyDescriptor(ns, Symbol.iterator);
|
||||
|
||||
assert.sameValue(desc.enumerable, false, 'reports as non-enumerable');
|
||||
assert.sameValue(desc.writable, true, 'reports as writable');
|
||||
assert.sameValue(desc.configurable, true, 'reports as configurable');
|
@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
es6id: 26.3.2
|
||||
description: >
|
||||
Behavior when the `this` value is not a module namespace exotic object
|
||||
info: |
|
||||
1. Let N be the this value.
|
||||
2. If N is not a module namespace exotic object, throw a TypeError
|
||||
exception.
|
||||
flags: [module]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
import * as ns from './this-val-not-ns.js';
|
||||
|
||||
var iter = ns[Symbol.iterator];
|
||||
|
||||
assert.sameValue(typeof iter, 'function');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter();
|
||||
}, 'undefined');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.call({});
|
||||
}, 'ordinary object');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.call([]);
|
||||
}, 'Array exotic object');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.call(23);
|
||||
}, 'number literal');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.call(null);
|
||||
}, 'null');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.call('string literal');
|
||||
}, 'string literal');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.call(Symbol.iterator);
|
||||
}, 'symbol');
|
@ -0,0 +1,103 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
description: Iteration over exported names
|
||||
info: >
|
||||
15.2.1.18 Runtime Semantics: GetModuleNamespace
|
||||
|
||||
[...]
|
||||
3. If namespace is undefined, then
|
||||
a. Let exportedNames be ? module.GetExportedNames(« »).
|
||||
b. Let unambiguousNames be a new empty List.
|
||||
c. For each name that is an element of exportedNames,
|
||||
i. Let resolution be ? module.ResolveExport(name, « », « »).
|
||||
ii. If resolution is null, throw a SyntaxError exception.
|
||||
iii. If resolution is not "ambiguous", append name to
|
||||
unambiguousNames.
|
||||
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
|
||||
4. Return namespace.
|
||||
|
||||
9.4.6.12 ModuleNamespaceCreate (module, exports)
|
||||
|
||||
[...]
|
||||
7. Set M's [[Exports]] internal slot to exports.
|
||||
[...]
|
||||
|
||||
26.3.2 [ @@iterator ] ( )
|
||||
|
||||
[...]
|
||||
3. Let exports be the value of N's [[Exports]] internal slot.
|
||||
4. Return ! CreateListIterator(exports).
|
||||
|
||||
Note: identifiers have been selected such that runtimes which do not sort
|
||||
the [[Exports]] list may still pass. A separate test is dedicated to sort
|
||||
order.
|
||||
flags: [module]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
import * as ns from './values-binding-types.js';
|
||||
|
||||
export var a_local1;
|
||||
var local2;
|
||||
export { local2 as b_renamed };
|
||||
export { a_local1 as e_indirect } from './values-binding-types.js';
|
||||
export * from './values-binding-types_.js';
|
||||
|
||||
var iter = ns[Symbol.iterator]();
|
||||
var result;
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not initially done');
|
||||
assert.sameValue(result.value, 'a_local1');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'b_renamed');
|
||||
assert.sameValue(result.done, false , 'not done after "a_local1"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'c_localUninit1');
|
||||
assert.sameValue(result.done, false, 'not done after "b_renamed"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'd_renamedUninit');
|
||||
assert.sameValue(result.done, false, 'not done after "c_localUninit1"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'default');
|
||||
assert.sameValue(result.done, false, 'not done after "d_renamedUninit"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'e_indirect');
|
||||
assert.sameValue(result.done, false, 'not done after "default"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'f_indirectUninit');
|
||||
assert.sameValue(result.done, false, 'not done after "e_indirect"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'g_star');
|
||||
assert.sameValue(result.done, false, 'not done after "f_indirectUninit"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'h_starRenamed');
|
||||
assert.sameValue(result.done, false, 'not done after "g_star"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 'i_starIndirect');
|
||||
assert.sameValue(result.done, false, 'not done after "h_starRenamed"');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, true, 'done after "i_starIndirect"');
|
||||
assert.sameValue(result.value, undefined);
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, true, 'done after exhaustion');
|
||||
assert.sameValue(result.value, undefined);
|
||||
|
||||
export let c_localUninit1;
|
||||
let localUninit2;
|
||||
export { localUninit2 as d_renamedUninit };
|
||||
export { c_localUninit1 as f_indirectUninit } from './values-binding-types.js';
|
||||
export default null;
|
@ -0,0 +1,7 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
export var g_star;
|
||||
export { g_star as h_starRenamed };
|
||||
export { a_local1 as i_starIndirect } from './values-binding-types.js';
|
||||
|
@ -0,0 +1,133 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-@@iterator
|
||||
description: Iteration order over exported names
|
||||
info: >
|
||||
Iteration should include all non-ambiguous export names ordered as if an
|
||||
Array of those String values had been sorted using `Array.prototype.sort`
|
||||
using SortCompare as *comparefunction*.
|
||||
|
||||
15.2.1.18 Runtime Semantics: GetModuleNamespace
|
||||
|
||||
[...]
|
||||
3. If namespace is undefined, then
|
||||
a. Let exportedNames be ? module.GetExportedNames(« »).
|
||||
b. Let unambiguousNames be a new empty List.
|
||||
c. For each name that is an element of exportedNames,
|
||||
i. Let resolution be ? module.ResolveExport(name, « », « »).
|
||||
ii. If resolution is null, throw a SyntaxError exception.
|
||||
iii. If resolution is not "ambiguous", append name to
|
||||
unambiguousNames.
|
||||
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
|
||||
4. Return namespace.
|
||||
|
||||
9.4.6.12 ModuleNamespaceCreate (module, exports)
|
||||
|
||||
[...]
|
||||
7. Set M's [[Exports]] internal slot to exports.
|
||||
[...]
|
||||
|
||||
26.3.2 [ @@iterator ] ( )
|
||||
|
||||
[...]
|
||||
3. Let exports be the value of N's [[Exports]] internal slot.
|
||||
4. Return ! CreateListIterator(exports).
|
||||
flags: [module]
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
var x;
|
||||
export { x as π }; // u03c0
|
||||
export { x as az };
|
||||
export { x as __ };
|
||||
export { x as za };
|
||||
export { x as Z };
|
||||
export { x as \u03bc };
|
||||
export { x as z };
|
||||
export { x as zz };
|
||||
export { x as a };
|
||||
export { x as A };
|
||||
export { x as aa };
|
||||
export { x as λ }; // u03bb
|
||||
export { x as _ };
|
||||
export { x as $$ };
|
||||
export { x as $ };
|
||||
export default null;
|
||||
|
||||
import * as ns from './values-order.js';
|
||||
|
||||
var iter = ns[Symbol.iterator]();
|
||||
var result;
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not initially done');
|
||||
assert.sameValue(result.value, '$');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "$"');
|
||||
assert.sameValue(result.value, '$$');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "$$"');
|
||||
assert.sameValue(result.value, 'A');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "A"');
|
||||
assert.sameValue(result.value, 'Z');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "Z"');
|
||||
assert.sameValue(result.value, '_');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "_"');
|
||||
assert.sameValue(result.value, '__');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "__"');
|
||||
assert.sameValue(result.value, 'a');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "a"');
|
||||
assert.sameValue(result.value, 'aa');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "aa"');
|
||||
assert.sameValue(result.value, 'az');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "az"');
|
||||
assert.sameValue(result.value, 'default');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "default"');
|
||||
assert.sameValue(result.value, 'z');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "z"');
|
||||
assert.sameValue(result.value, 'za');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "za"');
|
||||
assert.sameValue(result.value, 'zz');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "zz"');
|
||||
assert.sameValue(result.value, '\u03bb');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "\u03bb"');
|
||||
assert.sameValue(result.value, '\u03bc');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, false, 'not done following "\u03bc"');
|
||||
assert.sameValue(result.value, '\u03c0');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, true, 'done following "\u03c0"');
|
||||
assert.sameValue(result.value, undefined);
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.done, true, 'done following exhaustion');
|
||||
assert.sameValue(result.value, undefined);
|
29
test/language/module-code/namespace/Symbol.toStringTag.js
Normal file
29
test/language/module-code/namespace/Symbol.toStringTag.js
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 26.3.1
|
||||
esid: sec-@@tostringtag
|
||||
description: >
|
||||
`Symbol.toStringTag` property descriptor
|
||||
info: >
|
||||
The initial value of the @@toStringTag property is the String value
|
||||
"Module".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||
false, [[Configurable]]: true }.
|
||||
flags: [module]
|
||||
features: [Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
import * as ns from './Symbol.toStringTag.js';
|
||||
assert.sameValue(ns[Symbol.toStringTag], 'Module');
|
||||
|
||||
// propertyHelper.js is not appropriate for this test because it assumes that
|
||||
// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
|
||||
// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
|
||||
// object does not.
|
||||
var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
|
||||
|
||||
assert.sameValue(desc.enumerable, false, 'reports as non-enumerable');
|
||||
assert.sameValue(desc.writable, false, 'reports as non-writable');
|
||||
assert.sameValue(desc.configurable, true, 'reports as configurable');
|
@ -0,0 +1,88 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-defineownproperty-p-desc
|
||||
description: >
|
||||
The [[DefineOwnProperty]] internal method consistently returns `false`
|
||||
info: |
|
||||
1. Return false.
|
||||
flags: [module]
|
||||
features: [Reflect, Symbol.iterator, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
import * as ns from './define-own-property.js';
|
||||
export var local1;
|
||||
var local2;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './define-own-property.js';
|
||||
var sym = Symbol('test262');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'local1', {}),
|
||||
false,
|
||||
'Reflect.defineProperty: local1'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'local1', {});
|
||||
}, 'Object.defineProperty: local1');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'local2', {}),
|
||||
false,
|
||||
'Reflect.defineProperty: local2'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'local2', {});
|
||||
}, 'Object.defineProperty: local2');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'renamed', {}),
|
||||
false,
|
||||
'Reflect.defineProperty: renamed'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'renamed', {});
|
||||
}, 'Object.defineProperty: renamed');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'indirect', {}),
|
||||
false,
|
||||
'Reflect.defineProperty: indirect'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'indirect', {});
|
||||
}, 'Object.defineProperty: indirect');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, 'default', {}),
|
||||
false,
|
||||
'Reflect.defineProperty: default'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, 'default', {});
|
||||
}, 'Object.defineProperty: default');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, Symbol.iterator, {}),
|
||||
false,
|
||||
'Reflect.defineProperty: Symbol.iterator'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, Symbol.iterator, {});
|
||||
}, 'Object.defineProperty: Symbol.iterator');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, Symbol.toStringTag, {}),
|
||||
false,
|
||||
'Reflect.defineProperty: Symbol.toStringTag'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, Symbol.toStringTag, {});
|
||||
}, 'Object.defineProperty: Symbol.toStringTag');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.defineProperty(ns, sym, {}), false, 'Reflect.defineProperty: sym'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(ns, sym, {});
|
||||
}, 'Object.defineProperty: symbol');
|
@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-delete-p
|
||||
description: >
|
||||
[[Delete]] behavior for a key that describes an initialized exported
|
||||
binding
|
||||
info: |
|
||||
[...]
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is an element of exports, return false.
|
||||
flags: [module]
|
||||
features: [Reflect]
|
||||
---*/
|
||||
|
||||
import * as ns from './delete-exported-init.js';
|
||||
export var local1 = 333;
|
||||
var local2 = 444;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './delete-exported-init.js';
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.local1;
|
||||
}, 'delete: local1');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
|
||||
);
|
||||
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.renamed;
|
||||
}, 'delete: renamed');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
|
||||
);
|
||||
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.indirect;
|
||||
}, 'delete: indirect');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'indirect'),
|
||||
false,
|
||||
'Reflect.deleteProperty: indirect'
|
||||
);
|
||||
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
|
@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-delete-p
|
||||
description: >
|
||||
[[Delete]] behavior for a key that describes an uninitialized exported
|
||||
binding
|
||||
info: |
|
||||
[...]
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is an element of exports, return false.
|
||||
flags: [module]
|
||||
features: [Reflect, let]
|
||||
---*/
|
||||
|
||||
import * as ns from './delete-exported-uninit.js';
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.local1;
|
||||
}, 'delete: local1');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
|
||||
);
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.local1;
|
||||
}, 'binding unmodified: local1');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.renamed;
|
||||
}, 'delete: renamed');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
|
||||
);
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.renamed;
|
||||
}, 'binding unmodified: renamed');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.indirect;
|
||||
}, 'delete: indirect');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'indirect'),
|
||||
false,
|
||||
'Reflect.deleteProperty: indirect'
|
||||
);
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.indirect;
|
||||
}, 'binding unmodified: indirect');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
delete ns.default;
|
||||
}, 'delete: default');
|
||||
assert.sameValue(
|
||||
Reflect.deleteProperty(ns, 'default'),
|
||||
false,
|
||||
'Reflect.deleteProperty: default'
|
||||
);
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.default;
|
||||
}, 'binding unmodified: default');
|
||||
|
||||
export let local1 = 23;
|
||||
let local2 = 45;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './delete-exported-uninit.js';
|
||||
export default null;
|
@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-delete-p
|
||||
description: >
|
||||
[[Delete]] behavior for a key that does not describe an exported binding
|
||||
info: |
|
||||
[...]
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is an element of exports, return false.
|
||||
4. Return true.
|
||||
flags: [module]
|
||||
features: [Reflect, Symbol, Symbol.iterator, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
import * as ns from './delete-non-exported.js';
|
||||
var sym = Symbol('test262');
|
||||
|
||||
assert(delete ns.undef, 'delete: undef');
|
||||
assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
|
||||
|
||||
assert(delete ns.default, 'delete: default');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
|
||||
);
|
||||
|
||||
assert(delete ns[Symbol.iterator], 'delete: Symbol.iterator');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, Symbol.iterator),
|
||||
'Reflect.deleteProperty: Symbol.iterator'
|
||||
);
|
||||
|
||||
assert(delete ns[Symbol.toStringTag], 'delete: Symbol.toStringTag');
|
||||
assert(
|
||||
Reflect.deleteProperty(ns, Symbol.toStringTag),
|
||||
'Reflect.deleteProperty: Symbol.toStringTag'
|
||||
);
|
||||
|
||||
assert(delete ns[sym], 'delete: symbol');
|
||||
assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
|
@ -0,0 +1,60 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-getownproperty-p
|
||||
description: >
|
||||
Behavior of the [[GetOwnProperty]] internal method with a string argument
|
||||
describing an initialized binding
|
||||
info: |
|
||||
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is not an element of exports, return undefined.
|
||||
4. Let value be ? O.[[Get]](P, O).
|
||||
5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true,
|
||||
[[Enumerable]]: true, [[Configurable]]: false }.
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-own-property-str-found-init.js';
|
||||
export var local1 = 201;
|
||||
var local2 = 207;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './get-own-property-str-found-init.js';
|
||||
export default 302;
|
||||
var desc;
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'local1'), true
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
|
||||
assert.sameValue(desc.value, 201);
|
||||
assert.sameValue(desc.enumerable, true, 'local1 enumerable');
|
||||
assert.sameValue(desc.writable, true, 'local1 writable');
|
||||
assert.sameValue(desc.configurable, false, 'local1 configurable');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'renamed'), true
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
|
||||
assert.sameValue(desc.value, 207);
|
||||
assert.sameValue(desc.enumerable, true, 'renamed enumerable');
|
||||
assert.sameValue(desc.writable, true, 'renamed writable');
|
||||
assert.sameValue(desc.configurable, false, 'renamed configurable');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'indirect'), true
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
|
||||
assert.sameValue(desc.indirect, 201);
|
||||
assert.sameValue(desc.enumerable, true, 'indirect enumerable');
|
||||
assert.sameValue(desc.writable, true, 'indirect writable');
|
||||
assert.sameValue(desc.configurable, false, 'indirect configurable');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'default'), true
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'default');
|
||||
assert.sameValue(desc.default, 302);
|
||||
assert.sameValue(desc.enumerable, true, 'default enumerable');
|
||||
assert.sameValue(desc.writable, true, 'default writable');
|
||||
assert.sameValue(desc.configurable, false, 'default configurable');
|
@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-getownproperty-p
|
||||
description: >
|
||||
Behavior of the [[GetOwnProperty]] internal method with a string argument
|
||||
describing an uninitialized binding
|
||||
info: |
|
||||
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is not an element of exports, return undefined.
|
||||
4. Let value be ? O.[[Get]](P, O).
|
||||
flags: [module]
|
||||
features: [let]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-own-property-str-found-uninit.js';
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.prototype.hasOwnProperty.call(ns, 'local1');
|
||||
}, 'hasOwnProperty: local1');
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.getOwnPropertyDescriptor(ns, 'local1');
|
||||
}, 'getOwnPropertyDescriptor: local1');
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.prototype.hasOwnProperty.call(ns, 'renamed');
|
||||
}, 'hasOwnProperty: renamed');
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.getOwnPropertyDescriptor(ns, 'renamed');
|
||||
}, 'getOwnPropertyDescriptor: renamed');
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.prototype.hasOwnProperty.call(ns, 'indirect');
|
||||
}, 'hasOwnProperty: indirect');
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.getOwnPropertyDescriptor(ns, 'indirect');
|
||||
}, 'getOwnPropertyDescriptor: indirect');
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.prototype.hasOwnProperty.call(ns, 'default');
|
||||
}, 'hasOwnProperty: default');
|
||||
assert.throws(ReferenceError, function() {
|
||||
Object.getOwnPropertyDescriptor(ns, 'default');
|
||||
}, 'getOwnPropertyDescriptor: default');
|
||||
|
||||
export let local1 = 23;
|
||||
let local2 = 45;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './get-own-property-str-found-uninit.js';
|
||||
export default null;
|
@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-getownproperty-p
|
||||
description: >
|
||||
Behavior of the [[GetOwnProperty]] internal method with a string argument
|
||||
describing a binding that cannot be found
|
||||
info: |
|
||||
1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is not an element of exports, return undefined.
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-own-property-str-not-found.js';
|
||||
var test262;
|
||||
export { test262 as anotherName };
|
||||
var desc;
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'test262'),
|
||||
false,
|
||||
'hasOwnProperty: test262'
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'test262');
|
||||
assert.sameValue(desc, undefined, 'property descriptor for "test262"');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'desc'),
|
||||
false,
|
||||
'hasOwnProperty: desc'
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'desc');
|
||||
assert.sameValue(desc, undefined, 'property descriptor for "desc"');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'toStringTag'),
|
||||
false,
|
||||
'hasOwnProperty: toStringTag'
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'toStringTag');
|
||||
assert.sameValue(desc, undefined, 'property descriptor for "toStringTag"');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'iterator'),
|
||||
false,
|
||||
'hasOwnProperty: iterator'
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'iterator');
|
||||
assert.sameValue(desc, undefined, 'property descriptor for "iterator"');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, '__proto__'),
|
||||
false,
|
||||
'hasOwnProperty: __proto__'
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, '__proto__');
|
||||
assert.sameValue(desc, undefined, 'property descriptor for "__proto__"');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, 'default'),
|
||||
false,
|
||||
'hasOwnProperty: default'
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, 'default');
|
||||
assert.sameValue(desc, undefined, 'property descriptor for "default"');
|
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-getownproperty-p
|
||||
description: >
|
||||
Behavior of the [[GetOwnProperty]] internal method with a Symbol argument
|
||||
flags: [module]
|
||||
features: [Symbol, Symbol.iterator, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-own-property-sym.js';
|
||||
var notFound = Symbol('test262');
|
||||
var desc;
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), true
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, Symbol.iterator);
|
||||
assert.sameValue(desc.value, ns[Symbol.iterator]);
|
||||
assert.sameValue(desc.enumerable, false, 'Symbol.iterator enumerable');
|
||||
assert.sameValue(desc.writable, true, 'Symbol.iterator writable');
|
||||
assert.sameValue(desc.configurable, true, 'Symbol.iterator configurable');
|
||||
|
||||
assert.sameValue(
|
||||
Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true
|
||||
);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
|
||||
assert.sameValue(desc.value, ns[Symbol.toStringTag]);
|
||||
assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable');
|
||||
assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable');
|
||||
assert.sameValue(desc.configurable, true, 'Symbol.toStringTag configurable');
|
||||
|
||||
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false);
|
||||
desc = Object.getOwnPropertyDescriptor(ns, notFound);
|
||||
assert.sameValue(desc, undefined);
|
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-getprototypeof
|
||||
description: The [[GetPrototypeOf]] internal method returns `null`
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-prototype-of.js';
|
||||
|
||||
assert.sameValue(ns instanceof Object, false);
|
||||
assert.sameValue(Object.getPrototypeOf(ns), null);
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: >
|
||||
Behavior of the [[Get]] internal method with a string argument for exported
|
||||
initialized bindings.
|
||||
info: |
|
||||
[...]
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-str-found-init.js';
|
||||
export var local1 = 23;
|
||||
var local2 = 45;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './get-str-found-init.js';
|
||||
export default 444;
|
||||
|
||||
assert.sameValue(ns.local1, 23);
|
||||
assert.sameValue(ns.renamed, 45);
|
||||
assert.sameValue(ns.indirect, 23);
|
||||
assert.sameValue(ns.default, 444);
|
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: >
|
||||
Behavior of the [[Get]] internal method with a string argument for exported
|
||||
uninitialized bindings.
|
||||
info: |
|
||||
[...]
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
flags: [module]
|
||||
features: [let]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-str-found-uninit.js';
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.local1;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.renamed;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.indirect;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
ns.default;
|
||||
});
|
||||
|
||||
export let local1 = 23;
|
||||
let local2 = 45;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './get-str-found-uninit.js';
|
||||
export default null;
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: >
|
||||
References observe the initialization of lexical bindings
|
||||
info: |
|
||||
[...]
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
flags: [module]
|
||||
features: [let]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-str-initialize.js';
|
||||
export let localUninit1 = 111;
|
||||
let localUninit2 = 222;
|
||||
export { localUninit2 as renamedUninit };
|
||||
export { localUninit1 as indirectUninit } from './get-str-initialize.js';
|
||||
export default 333;
|
||||
|
||||
assert.sameValue(ns.localUninit1, 111);
|
||||
assert.sameValue(ns.renamedUninit, 222);
|
||||
assert.sameValue(ns.indirectUninit, 111);
|
||||
assert.sameValue(ns.default, 333);
|
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: >
|
||||
Behavior of the [[Get]] internal method with a string argument for
|
||||
non-exported bindings
|
||||
info: |
|
||||
[...]
|
||||
3. Let exports be the value of O's [[Exports]] internal slot.
|
||||
4. If P is not an element of exports, return undefined.
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-str-not-found.js';
|
||||
var test262;
|
||||
export { test262 as anotherName };
|
||||
|
||||
assert.sameValue(ns.test262, undefined, 'key: test262');
|
||||
assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag');
|
||||
assert.sameValue(ns.iterator, undefined, 'key: iterator');
|
||||
assert.sameValue(ns.__proto__, undefined, 'key: __proto__');
|
||||
assert.sameValue(ns.default, undefined, 'key: default');
|
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: References observe the mutation of initialized bindings
|
||||
info: |
|
||||
[...]
|
||||
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
|
||||
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-str-update.js';
|
||||
export var local1 = 111;
|
||||
var local2 = 222;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './get-str-update.js';
|
||||
|
||||
local1 = 333;
|
||||
local2 = 444;
|
||||
|
||||
assert.sameValue(ns.local1, 333);
|
||||
assert.sameValue(ns.renamed, 444);
|
||||
assert.sameValue(ns.indirect, 333);
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: >
|
||||
Behavior of the [[Get]] internal method with a symbol argument that can be
|
||||
found
|
||||
info: |
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryGet(O, P, Receiver).
|
||||
flags: [module]
|
||||
features: [Symbol.iterator, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-sym-found.js';
|
||||
|
||||
assert.sameValue(typeof ns[Symbol.iterator], 'function');
|
||||
assert.sameValue(typeof ns[Symbol.toStringTag], 'string');
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-get-p-receiver
|
||||
description: >
|
||||
Behavior of the [[Get]] internal method with a symbol argument that cannot
|
||||
be found
|
||||
info: |
|
||||
[...]
|
||||
2. If Type(P) is Symbol, then
|
||||
a. Return ? OrdinaryGet(O, P, Receiver).
|
||||
flags: [module]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
import * as ns from './get-sym-not-found.js';
|
||||
|
||||
assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262');
|
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-hasproperty-p
|
||||
description: >
|
||||
Behavior of the [[HasProperty]] internal method with a string argument for
|
||||
exported initialized bindings.
|
||||
info: |
|
||||
[...]
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is an element of exports, return true.
|
||||
flags: [module]
|
||||
features: [Reflect]
|
||||
---*/
|
||||
|
||||
import * as ns from './has-property-str-found-init.js';
|
||||
export var local1;
|
||||
var local2;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './has-property-str-found-init.js';
|
||||
export default null;
|
||||
|
||||
assert('local1' in ns, 'in: local1');
|
||||
assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1');
|
||||
|
||||
assert('renamed' in ns, 'in: renamed');
|
||||
assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed');
|
||||
|
||||
assert('indirect' in ns, 'in: indirect');
|
||||
assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect');
|
||||
|
||||
assert('default' in ns, 'in: default');
|
||||
assert(Reflect.has(ns, 'default'), 'Reflect.has: default');
|
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-hasproperty-p
|
||||
description: >
|
||||
Behavior of the [[HasProperty]] internal method with a string argument for
|
||||
exported uninitialized bindings.
|
||||
info: |
|
||||
[...]
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is an element of exports, return true.
|
||||
4. Return false.
|
||||
flags: [module]
|
||||
features: [Reflect, let]
|
||||
---*/
|
||||
|
||||
import * as ns from './has-property-str-found-uninit.js';
|
||||
|
||||
assert('local1' in ns, 'in: local1');
|
||||
assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1');
|
||||
|
||||
assert('renamed' in ns, 'in: renamed');
|
||||
assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed');
|
||||
|
||||
assert('indirect' in ns, 'in: indirect');
|
||||
assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect');
|
||||
|
||||
assert('default' in ns, 'in: default');
|
||||
assert(Reflect.has(ns, 'default'), 'Reflect.has: default');
|
||||
|
||||
export let local1 = 23;
|
||||
let local2 = 45;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './has-property-str-found-uninit.js';
|
||||
export default null;
|
@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-hasproperty-p
|
||||
description: >
|
||||
Behavior of the [[HasProperty]] internal method with a string argument for
|
||||
non-exported bindings
|
||||
info: |
|
||||
[...]
|
||||
2. Let exports be the value of O's [[Exports]] internal slot.
|
||||
3. If P is an element of exports, return true.
|
||||
4. Return false.
|
||||
flags: [module]
|
||||
features: [Reflect]
|
||||
---*/
|
||||
|
||||
import * as ns from './has-property-str-not-found.js';
|
||||
var test262;
|
||||
export { test262 as anotherName };
|
||||
|
||||
assert.sameValue('test262' in ns, false, 'in: test262');
|
||||
assert.sameValue(Reflect.has(ns, 'test262'), false, 'Reflect.has: test262');
|
||||
|
||||
assert.sameValue('toStringTag' in ns, false, 'in: toStringTag');
|
||||
assert.sameValue(
|
||||
Reflect.has(ns, 'toStringTag'), false, 'Reflect.has: toStringTag'
|
||||
);
|
||||
|
||||
assert.sameValue('iterator' in ns, false, 'in: iterator');
|
||||
assert.sameValue(Reflect.has(ns, 'iterator'), false, 'Reflect.has: iterator');
|
||||
|
||||
assert.sameValue('__proto__' in ns, false, 'in: __proto__');
|
||||
assert.sameValue(
|
||||
Reflect.has(ns, '__proto__'), false, 'Reflect.has: __proto__'
|
||||
);
|
||||
|
||||
assert.sameValue('default' in ns, false, 'in: default');
|
||||
assert.sameValue(Reflect.has(ns, 'default'), false, 'Reflect.has: default');
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-hasproperty-p
|
||||
description: >
|
||||
Behavior of the [[HasProperty]] internal method with a symbol argument that
|
||||
can be found
|
||||
info: |
|
||||
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
|
||||
flags: [module]
|
||||
features: [Symbol.iterator, Symbol.toStringTag, Reflect]
|
||||
---*/
|
||||
|
||||
import * as ns from './has-property-sym-found.js';
|
||||
|
||||
assert(Symbol.iterator in ns, 'in: Symbol.iterator');
|
||||
assert(Reflect.has(ns, Symbol.iterator), 'Reflect.has: Symbol.iterator');
|
||||
assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag');
|
||||
assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag');
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-hasproperty-p
|
||||
description: >
|
||||
Behavior of the [[HasProperty]] internal method with a symbol argument that
|
||||
cannot be found
|
||||
info: |
|
||||
1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
|
||||
flags: [module]
|
||||
features: [Symbol, Reflect]
|
||||
---*/
|
||||
|
||||
import * as ns from './has-property-sym-not-found.js';
|
||||
var sym = Symbol('test262');
|
||||
|
||||
assert.sameValue(sym in ns, false, 'in');
|
||||
assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has');
|
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-isextensible
|
||||
description: The [[IsExtensible]] internal method returns `false`
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './is-extensible.js';
|
||||
|
||||
assert.sameValue(Object.isExtensible(ns), false);
|
@ -0,0 +1,85 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-ownpropertykeys
|
||||
description: >
|
||||
The [[OwnPropertyKeys]] internal method includes entries for all binding
|
||||
types
|
||||
info: |
|
||||
1. Let exports be a copy of the value of O's [[Exports]] internal slot.
|
||||
2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O).
|
||||
3. Append all the entries of symbolKeys to the end of exports.
|
||||
4. Return exports.
|
||||
|
||||
Note: identifiers have been selected such that runtimes which do not sort
|
||||
the [[Exports]] list may still pass. A separate test is dedicated to sort
|
||||
order.
|
||||
flags: [module]
|
||||
features: [Reflect, Symbol.iterator, Symbol.toStringTag, let]
|
||||
---*/
|
||||
|
||||
import * as ns from './own-property-keys-binding-types.js';
|
||||
export var a_local1;
|
||||
var local2;
|
||||
export { local2 as b_renamed };
|
||||
export { a_local1 as e_indirect } from './own-property-keys-binding-types.js';
|
||||
export * from './own-property-keys-binding-types_.js';
|
||||
|
||||
var stringKeys = Object.getOwnPropertyNames(ns);
|
||||
|
||||
assert.sameValue(stringKeys.length, 10);
|
||||
assert.sameValue(stringKeys[0], 'a_local1');
|
||||
assert.sameValue(stringKeys[1], 'b_renamed');
|
||||
assert.sameValue(stringKeys[2], 'c_localUninit1');
|
||||
assert.sameValue(stringKeys[3], 'd_renamedUninit');
|
||||
assert.sameValue(stringKeys[4], 'default');
|
||||
assert.sameValue(stringKeys[5], 'e_indirect');
|
||||
assert.sameValue(stringKeys[6], 'f_indirectUninit');
|
||||
assert.sameValue(stringKeys[7], 'g_star');
|
||||
assert.sameValue(stringKeys[8], 'h_starRenamed');
|
||||
assert.sameValue(stringKeys[9], 'i_starIndirect');
|
||||
|
||||
var symbolKeys = Object.getOwnPropertySymbols(ns);
|
||||
|
||||
assert(
|
||||
symbolKeys.length > 1,
|
||||
'at least as many Symbol keys as defined by the specification'
|
||||
);
|
||||
assert(
|
||||
symbolKeys.indexOf(Symbol.iterator) > -1,
|
||||
'Symbol keys array includes Symbol.iterator'
|
||||
);
|
||||
assert(
|
||||
symbolKeys.indexOf(Symbol.toStringTag) > -1,
|
||||
'Symbol keys array includes Symbol.toStringTag'
|
||||
);
|
||||
|
||||
var allKeys = Reflect.ownKeys(ns);
|
||||
|
||||
assert(
|
||||
allKeys.length > 11,
|
||||
'at least as many keys as defined by the module and the specification'
|
||||
);
|
||||
assert.sameValue(allKeys[0], 'a_local1');
|
||||
assert.sameValue(allKeys[1], 'b_renamed');
|
||||
assert.sameValue(allKeys[2], 'c_localUninit1');
|
||||
assert.sameValue(allKeys[3], 'd_renamedUninit');
|
||||
assert.sameValue(allKeys[4], 'default');
|
||||
assert.sameValue(allKeys[5], 'e_indirect');
|
||||
assert.sameValue(allKeys[6], 'f_indirectUninit');
|
||||
assert.sameValue(allKeys[7], 'g_star');
|
||||
assert.sameValue(allKeys[8], 'h_starRenamed');
|
||||
assert.sameValue(allKeys[9], 'i_starIndirect');
|
||||
assert(
|
||||
allKeys.indexOf(Symbol.iterator) > 9, 'keys array includes Symbol.iterator'
|
||||
);
|
||||
assert(
|
||||
allKeys.indexOf(Symbol.toStringTag) > 9,
|
||||
'keys array includes Symbol.toStringTag'
|
||||
);
|
||||
|
||||
export let c_localUninit1;
|
||||
let localUninit2;
|
||||
export { localUninit2 as d_renamedUninit };
|
||||
export { c_localUninit1 as f_indirectUninit } from './own-property-keys-binding-types.js';
|
||||
export default null;
|
@ -0,0 +1,6 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
export var g_star;
|
||||
export { g_star as h_starRenamed };
|
||||
export { a_local1 as i_starIndirect } from './own-property-keys-binding-types.js';
|
@ -0,0 +1,83 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-ownpropertykeys
|
||||
description: >
|
||||
The [[OwnPropertyKeys]] internal method reflects the sorted order
|
||||
info: |
|
||||
1. Let exports be a copy of the value of O's [[Exports]] internal slot.
|
||||
2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O).
|
||||
3. Append all the entries of symbolKeys to the end of exports.
|
||||
4. Return exports.
|
||||
flags: [module]
|
||||
features: [Reflect, Symbol.iterator, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
var x;
|
||||
export { x as π }; // u03c0
|
||||
export { x as az };
|
||||
export { x as __ };
|
||||
export { x as za };
|
||||
export { x as Z };
|
||||
export { x as \u03bc };
|
||||
export { x as z };
|
||||
export { x as zz };
|
||||
export { x as a };
|
||||
export { x as A };
|
||||
export { x as aa };
|
||||
export { x as λ }; // u03bb
|
||||
export { x as _ };
|
||||
export { x as $$ };
|
||||
export { x as $ };
|
||||
export default null;
|
||||
|
||||
import * as ns from './own-property-keys-sort.js';
|
||||
|
||||
var stringKeys = Object.getOwnPropertyNames(ns);
|
||||
|
||||
assert.sameValue(stringKeys.length, 16);
|
||||
assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
|
||||
assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
|
||||
assert.sameValue(stringKeys[2], 'A', 'stringKeys[2] === "A"');
|
||||
assert.sameValue(stringKeys[3], 'Z', 'stringKeys[3] === "Z"');
|
||||
assert.sameValue(stringKeys[4], '_', 'stringKeys[4] === "_"');
|
||||
assert.sameValue(stringKeys[5], '__', 'stringKeys[5] === "__"');
|
||||
assert.sameValue(stringKeys[6], 'a', 'stringKeys[6] === "a"');
|
||||
assert.sameValue(stringKeys[7], 'aa', 'stringKeys[7] === "aa"');
|
||||
assert.sameValue(stringKeys[8], 'az', 'stringKeys[8] === "az"');
|
||||
assert.sameValue(stringKeys[9], 'default', 'stringKeys[9] === "default"');
|
||||
assert.sameValue(stringKeys[10], 'z', 'stringKeys[10] === "z"');
|
||||
assert.sameValue(stringKeys[11], 'za', 'stringKeys[11] === "za"');
|
||||
assert.sameValue(stringKeys[12], 'zz', 'stringKeys[12] === "zz"');
|
||||
assert.sameValue(stringKeys[13], '\u03bb', 'stringKeys[13] === "\u03bb"');
|
||||
assert.sameValue(stringKeys[14], '\u03bc', 'stringKeys[14] === "\u03bc"');
|
||||
assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"');
|
||||
|
||||
var allKeys = Reflect.ownKeys(ns);
|
||||
assert(
|
||||
allKeys.length > 17,
|
||||
'at least as many keys as defined by the module and the specification'
|
||||
);
|
||||
assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
|
||||
assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
|
||||
assert.sameValue(allKeys[2], 'A', 'allKeys[2] === "A"');
|
||||
assert.sameValue(allKeys[3], 'Z', 'allKeys[3] === "Z"');
|
||||
assert.sameValue(allKeys[4], '_', 'allKeys[4] === "_"');
|
||||
assert.sameValue(allKeys[5], '__', 'allKeys[5] === "__"');
|
||||
assert.sameValue(allKeys[6], 'a', 'allKeys[6] === "a"');
|
||||
assert.sameValue(allKeys[7], 'aa', 'allKeys[7] === "aa"');
|
||||
assert.sameValue(allKeys[8], 'az', 'allKeys[8] === "az"');
|
||||
assert.sameValue(allKeys[9], 'default', 'allKeys[9] === "default"');
|
||||
assert.sameValue(allKeys[10], 'z', 'allKeys[10] === "z"');
|
||||
assert.sameValue(allKeys[11], 'za', 'allKeys[11] === "za"');
|
||||
assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"');
|
||||
assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"');
|
||||
assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"');
|
||||
assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"');
|
||||
assert(
|
||||
allKeys.indexOf(Symbol.iterator) > 15, 'keys array includes Symbol.iterator'
|
||||
);
|
||||
assert(
|
||||
allKeys.indexOf(Symbol.toStringTag) > 15,
|
||||
'keys array includes Symbol.toStringTag'
|
||||
);
|
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-preventextensions
|
||||
description: The [[PreventExtensions]] internal method returns `true`
|
||||
flags: [module]
|
||||
features: [Reflect]
|
||||
---*/
|
||||
|
||||
import * as ns from './prevent-extensions.js';
|
||||
|
||||
// This invocation should not throw an exception
|
||||
Object.preventExtensions(ns);
|
||||
|
||||
assert.sameValue(Reflect.preventExtensions(ns), true);
|
@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-setprototypeof
|
||||
description: The [[SetPrototypeOf]] internal method returns `false`
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import * as ns from './set-prototype-of.js';
|
||||
var newProto = {};
|
||||
|
||||
assert.sameValue(typeof Object.setPrototypeOf, 'function');
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.setPrototypeOf(ns, newProto);
|
||||
});
|
63
test/language/module-code/namespace/internals/set.js
Normal file
63
test/language/module-code/namespace/internals/set.js
Normal file
@ -0,0 +1,63 @@
|
||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-module-namespace-exotic-objects-set-p-v-receiver
|
||||
description: The [[Set]] internal method consistently returns `false`
|
||||
info: |
|
||||
1. Return false.
|
||||
flags: [module]
|
||||
features: [Reflect, Symbol.iterator, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
import * as ns from './define-own-property.js';
|
||||
export var local1 = null;
|
||||
var local2 = null;
|
||||
export { local2 as renamed };
|
||||
export { local1 as indirect } from './define-own-property.js';
|
||||
var sym = Symbol('test262');
|
||||
|
||||
assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1');
|
||||
assert.throws(TypeError, function() {
|
||||
ns.local1 = null;
|
||||
}, 'AssignmentExpression: local1');
|
||||
|
||||
assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2');
|
||||
assert.throws(TypeError, function() {
|
||||
ns.local2 = null;
|
||||
}, 'AssignmentExpression: local2');
|
||||
|
||||
assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed');
|
||||
assert.throws(TypeError, function() {
|
||||
ns.renamed = null;
|
||||
}, 'AssignmentExpression: renamed');
|
||||
|
||||
assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect');
|
||||
assert.throws(TypeError, function() {
|
||||
ns.indirect = null;
|
||||
}, 'AssignmentExpression: indirect');
|
||||
|
||||
assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default');
|
||||
assert.throws(TypeError, function() {
|
||||
ns.default = null;
|
||||
}, 'AssignmentExpression: default');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.set(ns, Symbol.iterator), false, 'Reflect.set: Symbol.iterator'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
ns[Symbol.iterator] = null;
|
||||
}, 'AssignmentExpression: Symbol.iterator');
|
||||
|
||||
assert.sameValue(
|
||||
Reflect.set(ns, Symbol.toStringTag),
|
||||
false,
|
||||
'Reflect.set: Symbol.toStringTag'
|
||||
);
|
||||
assert.throws(TypeError, function() {
|
||||
ns[Symbol.toStringTag] = null;
|
||||
}, 'AssignmentExpression: Symbol.toStringTag');
|
||||
|
||||
assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym');
|
||||
assert.throws(TypeError, function() {
|
||||
ns[sym] = null;
|
||||
}, 'AssignmentExpression: sym');
|
Loading…
x
Reference in New Issue
Block a user