More coverage for namespace object

This commit is contained in:
Leo Balter 2018-10-12 17:04:23 -04:00
parent b7e0a48725
commit 103ee25959
23 changed files with 663 additions and 3 deletions

View File

@ -0,0 +1,58 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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 }.
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'local1'), true
);
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
assert.sameValue(desc.value, 'Test262');
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, 'TC39');
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.value, 'Test262');
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.value, 42);
assert.sameValue(desc.enumerable, true, 'default enumerable');
assert.sameValue(desc.writable, true, 'default writable');
assert.sameValue(desc.configurable, false, 'default configurable');

View File

@ -0,0 +1,51 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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.
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
var desc;
assert.sameValue(
Object.prototype.hasOwnProperty.call(ns, 'local2'),
false,
'hasOwnProperty: local2'
);
desc = Object.getOwnPropertyDescriptor(ns, 'local2');
assert.sameValue(desc, undefined, 'property descriptor for "local2"');
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__"');

View File

@ -0,0 +1,31 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
Behavior of the [[GetOwnProperty]] internal method with a Symbol argument
features: [Symbol, Symbol.toStringTag]
template: namespace
---*/
//- setup
var notFound = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
var desc;
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, false, 'Symbol.toStringTag configurable');
assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false);
desc = Object.getOwnPropertyDescriptor(ns, notFound);
assert.sameValue(desc, undefined);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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).
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns.local1, 'Test262');
assert.sameValue(ns.renamed, 'TC39');
assert.sameValue(ns.indirect, 'Test262');
assert.sameValue(ns.default, 42);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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.
template: namespace
---*/
//- setup
var local2; // not used
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns.local2, undefined, 'key: local2');
assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag');
assert.sameValue(ns.iterator, undefined, 'key: iterator');
assert.sameValue(ns.__proto__, undefined, 'key: __proto__');

View File

@ -0,0 +1,20 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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).
features: [Symbol.toStringTag]
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(typeof ns[Symbol.toStringTag], 'string');

View File

@ -0,0 +1,20 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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).
features: [Symbol]
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262');

View File

@ -0,0 +1,29 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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.
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
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');

View File

@ -0,0 +1,37 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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.
template: namespace
---*/
//- setup
var local2; // not used
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue('local2' in ns, false, 'in: local2');
assert.sameValue(Reflect.has(ns, 'local2'), false, 'Reflect.has: local2');
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__'
);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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).
features: [Symbol.toStringTag]
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag');
assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag');

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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).
features: [Symbol]
template: namespace
---*/
//- setup
var sym = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(sym in ns, false, 'in');
assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has');

View File

@ -0,0 +1,64 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
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.
features: [Symbol.toStringTag]
template: namespace
---*/
//- import
import('./own-keys-sort_FIXTURE.js')
//- body
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.toStringTag) > 15,
'keys array includes Symbol.toStringTag'
);

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: The [[PreventExtensions]] internal method returns `true`
template: namespace
---*/
//- import
import('./empty_FIXTURE.js')
//- body
// This invocation should not throw an exception
Object.preventExtensions(ns);
assert.sameValue(Reflect.preventExtensions(ns), true);

View File

@ -0,0 +1,13 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: The [[PreventExtensions]] internal method returns `true`
template: namespace
---*/
//- import
import('./empty_FIXTURE.js')
//- body
assert.sameValue(Reflect.preventExtensions(ns), true);

View File

@ -5,8 +5,6 @@ desc: imported object properties descriptors
template: namespace
---*/
// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262'
//- import
import('./module-code_FIXTURE.js')
//- body
@ -35,7 +33,7 @@ assert.sameValue(desc.enumerable, true, 'renamed: is enumerable');
assert.sameValue(desc.writable, true, 'renamed: is writable');
assert.sameValue(desc.configurable, false, 'renamed: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'indirect:');
desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
assert.sameValue(desc.value, 'Test262', 'indirect: value is Test262"');
assert.sameValue(desc.enumerable, true, 'indirect: is enumerable');

View File

@ -8,4 +8,5 @@ template: namespace
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(ns instanceof Object, false);
assert.sameValue(Object.getPrototypeOf(ns), null, 'prototype is null');

View File

@ -0,0 +1,43 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: The [[Set]] internal method consistently returns `false`, No Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [noStrict]
---*/
//- setup
var sym = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1');
assert.sameValue(ns.local1 = null, null, 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2');
assert.sameValue(ns.local2 = null, null, 'AssignmentExpression: local2');
assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed');
assert.sameValue(ns.renamed = null, null, 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect');
assert.sameValue(ns.indirect = null, null, 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default');
assert.sameValue(ns.default = null, null, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, null),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.sameValue(ns[Symbol.toStringTag] = null, null, 'AssignmentExpression: Symbol.toStringTag');
assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym');
assert.sameValue(ns[sym] = null, null, 'AssignmentExpression: sym');

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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-v
desc: >
The [[SetPrototypeOf]] internal method returns `true` if
passed `null`
template: namespace
---*/
//- import
import('./empty_FIXTURE.js')
//- body
assert.sameValue(typeof Object.setPrototypeOf, 'function');
assert.sameValue(ns, Object.setPrototypeOf(ns, null));

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: The [[SetPrototypeOf]] internal method returns `false`
template: namespace
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
var newProto = {};
assert.sameValue(typeof Object.setPrototypeOf, 'function');
assert.throws(TypeError, function() {
Object.setPrototypeOf(ns, newProto);
});

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
The [[Set]] internal method consistently returns `false` even setting
the same value - No Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [noStrict]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1');
assert.sameValue(ns.local1 = 'Test262', 'Test262', 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed');
assert.sameValue(ns.renamed = 'TC39', 'TC39', 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect');
assert.sameValue(ns.indirect = 'Test262', 'Test262', 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default');
assert.sameValue(ns.default = 42, 42, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.sameValue(ns[Symbol.toStringTag] = ns[Symbol.toStringTag], 'Module', 'AssignmentExpression: Symbol.toStringTag');

View File

@ -0,0 +1,46 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: >
The [[Set]] internal method consistently returns `false` even setting
the same value - Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [onlyStrict]
---*/
//- import
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1');
assert.throws(TypeError, function() {
ns.local1 = 'Test262';
}, 'AssignmentExpression: local1');
assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed');
assert.throws(TypeError, function() {
ns.renamed = 'TC39';
}, 'AssignmentExpression: renamed');
assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect');
assert.throws(TypeError, function() {
ns.indirect = 'Test262';
}, 'AssignmentExpression: indirect');
assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default');
assert.throws(TypeError, function() {
ns.default = 42;
}, 'AssignmentExpression: default');
assert.sameValue(
Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]),
false,
'Reflect.set: Symbol.toStringTag'
);
assert.throws(TypeError, function() {
ns[Symbol.toStringTag] = ns[Symbol.toStringTag];
}, 'AssignmentExpression: Symbol.toStringTag');

View File

@ -0,0 +1,57 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// 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
desc: The [[Set]] internal method consistently returns `false`, Strict Mode
info: |
1. Return false.
features: [Symbol, Symbol.toStringTag]
template: namespace
flags: [onlyStrict]
---*/
//- setup
var sym = Symbol('test262');
//- import
import('./module-code_FIXTURE.js')
//- body
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.toStringTag, null),
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');

View File

@ -0,0 +1,17 @@
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;