diff --git a/src/dynamic-import/ns-get-own-property-str-found-init.case b/src/dynamic-import/ns-get-own-property-str-found-init.case new file mode 100644 index 0000000000000000000000000000000000000000..3d67db2bbcf5ef577ff4e3bf72ebaa71577eb109 --- /dev/null +++ b/src/dynamic-import/ns-get-own-property-str-found-init.case @@ -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'); diff --git a/src/dynamic-import/ns-get-own-property-str-not-found.case b/src/dynamic-import/ns-get-own-property-str-not-found.case new file mode 100644 index 0000000000000000000000000000000000000000..350aa004052376f79d3b3fd6516ba8cd4962b095 --- /dev/null +++ b/src/dynamic-import/ns-get-own-property-str-not-found.case @@ -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__"'); diff --git a/src/dynamic-import/ns-get-own-property-sym.case b/src/dynamic-import/ns-get-own-property-sym.case new file mode 100644 index 0000000000000000000000000000000000000000..e84169d34bfc278c3f9278215f038a40a9c06256 --- /dev/null +++ b/src/dynamic-import/ns-get-own-property-sym.case @@ -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); diff --git a/src/dynamic-import/ns-get-str-found.case b/src/dynamic-import/ns-get-str-found.case new file mode 100644 index 0000000000000000000000000000000000000000..5f26725bc3e80fe61d94a392ad13c4fdb756838d --- /dev/null +++ b/src/dynamic-import/ns-get-str-found.case @@ -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); diff --git a/src/dynamic-import/ns-get-str-not-found.case b/src/dynamic-import/ns-get-str-not-found.case new file mode 100644 index 0000000000000000000000000000000000000000..9cf702cdbfda93d0447ab8f304612b8aa7eea1cd --- /dev/null +++ b/src/dynamic-import/ns-get-str-not-found.case @@ -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__'); diff --git a/src/dynamic-import/ns-get-sym-found.case b/src/dynamic-import/ns-get-sym-found.case new file mode 100644 index 0000000000000000000000000000000000000000..49f2daeb3186f4aac4bfa69cfb3e84280675220e --- /dev/null +++ b/src/dynamic-import/ns-get-sym-found.case @@ -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'); diff --git a/src/dynamic-import/ns-get-sym-not-found.case b/src/dynamic-import/ns-get-sym-not-found.case new file mode 100644 index 0000000000000000000000000000000000000000..38e146f3369f70fd1b2a0fd89857f7677a8052fd --- /dev/null +++ b/src/dynamic-import/ns-get-sym-not-found.case @@ -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'); diff --git a/src/dynamic-import/ns-has-property-str-found-init.case b/src/dynamic-import/ns-has-property-str-found-init.case new file mode 100644 index 0000000000000000000000000000000000000000..3a713efda18c39f4901d86d7dc1aa35a7cf43195 --- /dev/null +++ b/src/dynamic-import/ns-has-property-str-found-init.case @@ -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'); diff --git a/src/dynamic-import/ns-has-property-str-not-found.case b/src/dynamic-import/ns-has-property-str-not-found.case new file mode 100644 index 0000000000000000000000000000000000000000..5d64a62270ace345679817110cc873b74e2739f7 --- /dev/null +++ b/src/dynamic-import/ns-has-property-str-not-found.case @@ -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__' +); diff --git a/src/dynamic-import/ns-has-property-sym-found.case b/src/dynamic-import/ns-has-property-sym-found.case new file mode 100644 index 0000000000000000000000000000000000000000..e3e8f33f05276b2767a32423302a94e02df624ce --- /dev/null +++ b/src/dynamic-import/ns-has-property-sym-found.case @@ -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'); diff --git a/src/dynamic-import/ns-has-property-sym-not-found.case b/src/dynamic-import/ns-has-property-sym-not-found.case new file mode 100644 index 0000000000000000000000000000000000000000..5f1e050e42415cd0b3ec16adebf359dcd2dd8b72 --- /dev/null +++ b/src/dynamic-import/ns-has-property-sym-not-found.case @@ -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'); diff --git a/src/dynamic-import/ns-own-property-keys-sort.case b/src/dynamic-import/ns-own-property-keys-sort.case new file mode 100644 index 0000000000000000000000000000000000000000..b946b02af5cdea90688aa6136daf297deebea192 --- /dev/null +++ b/src/dynamic-import/ns-own-property-keys-sort.case @@ -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' +); diff --git a/src/dynamic-import/ns-prevent-extensions-object.case b/src/dynamic-import/ns-prevent-extensions-object.case new file mode 100644 index 0000000000000000000000000000000000000000..bd1053066d463bb9b5b19e0443e519394fbeb0d1 --- /dev/null +++ b/src/dynamic-import/ns-prevent-extensions-object.case @@ -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); diff --git a/src/dynamic-import/ns-prevent-extensions-reflect.case b/src/dynamic-import/ns-prevent-extensions-reflect.case new file mode 100644 index 0000000000000000000000000000000000000000..4b54b3fa1304a435f075aba767db255c33728758 --- /dev/null +++ b/src/dynamic-import/ns-prevent-extensions-reflect.case @@ -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); diff --git a/src/dynamic-import/ns-prop-descs.case b/src/dynamic-import/ns-prop-descs.case index 8c9ef73daec66b4e90e8254e64d5e1f77d6edd6f..9bb34d9d86ffeaca9d93cebac6e7ef0b42f20b97 100644 --- a/src/dynamic-import/ns-prop-descs.case +++ b/src/dynamic-import/ns-prop-descs.case @@ -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'); diff --git a/src/dynamic-import/ns-prototype.case b/src/dynamic-import/ns-prototype.case index 3a8d66d41e02744dd78f10976ba95ca933903d97..d10f33b6d7d911515eb7c9724252714c5a5a0833 100644 --- a/src/dynamic-import/ns-prototype.case +++ b/src/dynamic-import/ns-prototype.case @@ -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'); diff --git a/src/dynamic-import/ns-set-no-strict.case b/src/dynamic-import/ns-set-no-strict.case new file mode 100644 index 0000000000000000000000000000000000000000..842e8cac7d27359c70124136a46e6e13d0368cc0 --- /dev/null +++ b/src/dynamic-import/ns-set-no-strict.case @@ -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'); diff --git a/src/dynamic-import/ns-set-prototype-of-null.case b/src/dynamic-import/ns-set-prototype-of-null.case new file mode 100644 index 0000000000000000000000000000000000000000..4ff405490917c71ac2cc7724f69ae1644c0de178 --- /dev/null +++ b/src/dynamic-import/ns-set-prototype-of-null.case @@ -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)); diff --git a/src/dynamic-import/ns-set-prototype-of.case b/src/dynamic-import/ns-set-prototype-of.case new file mode 100644 index 0000000000000000000000000000000000000000..c1926fa94789265e31aab0ab54cac8fd557c9a9e --- /dev/null +++ b/src/dynamic-import/ns-set-prototype-of.case @@ -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); +}); diff --git a/src/dynamic-import/ns-set-same-values-no-strict.case b/src/dynamic-import/ns-set-same-values-no-strict.case new file mode 100644 index 0000000000000000000000000000000000000000..e8ed24ffb5aa2e747d9a8b86e6b8b1b7eede7ec3 --- /dev/null +++ b/src/dynamic-import/ns-set-same-values-no-strict.case @@ -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'); diff --git a/src/dynamic-import/ns-set-same-values-strict.case b/src/dynamic-import/ns-set-same-values-strict.case new file mode 100644 index 0000000000000000000000000000000000000000..126ef0f95eae5b9b8512b492727c71f4f034d553 --- /dev/null +++ b/src/dynamic-import/ns-set-same-values-strict.case @@ -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'); diff --git a/src/dynamic-import/ns-set-strict.case b/src/dynamic-import/ns-set-strict.case new file mode 100644 index 0000000000000000000000000000000000000000..136e6f79f00b2942fbd9ecfcc47b128a4d364bd3 --- /dev/null +++ b/src/dynamic-import/ns-set-strict.case @@ -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'); diff --git a/test/language/module-code/dynamic-import/ns/own-keys-sort_FIXTURE.js b/test/language/module-code/dynamic-import/ns/own-keys-sort_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..53e5ea5a91b75a6ee2ca337d9171c542e3e7ade1 --- /dev/null +++ b/test/language/module-code/dynamic-import/ns/own-keys-sort_FIXTURE.js @@ -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;