diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Symbol | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Symbol')
134 files changed, 2372 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Symbol/asyncIterator/browser.js b/js/src/tests/test262/built-ins/Symbol/asyncIterator/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/asyncIterator/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/asyncIterator/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/asyncIterator/cross-realm.js new file mode 100644 index 0000000000..8cab56f171 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/asyncIterator/cross-realm.js @@ -0,0 +1,17 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.asynciterator +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.asyncIterator] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.asyncIterator, OSymbol.asyncIterator); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/asyncIterator/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/asyncIterator/prop-desc.js new file mode 100644 index 0000000000..872b52b2ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/asyncIterator/prop-desc.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.asynciterator +description: > + `Symbol.asyncIterator` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.asyncIterator] +---*/ + +assert.sameValue(typeof Symbol.asyncIterator, 'symbol'); + +verifyProperty(Symbol, 'asyncIterator', { + enumerable: false, + writable: false, + configurable: false, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/asyncIterator/shell.js b/js/src/tests/test262/built-ins/Symbol/asyncIterator/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/asyncIterator/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/auto-boxing-non-strict.js b/js/src/tests/test262/built-ins/Symbol/auto-boxing-non-strict.js new file mode 100644 index 0000000000..66cf29c508 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/auto-boxing-non-strict.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4 +description: > + Symbol ToObject auto-boxing +flags: [noStrict] +features: [Symbol] +---*/ + +var sym = Symbol('66'); + +sym.a = 0; +assert.sameValue(sym.a, undefined, "The value of `sym.a` is `undefined`, after executing `sym.a = 0;`"); + +sym['a' + 'b'] = 0; +assert.sameValue(sym['a' + 'b'], undefined, "The value of `sym['a' + 'b']` is `undefined`, after executing `sym['a' + 'b'] = 0;`"); + +sym[62] = 0; +assert.sameValue(sym[62], undefined, "The value of `sym[62]` is `undefined`, after executing `sym[62] = 0;`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/auto-boxing-strict-strict.js b/js/src/tests/test262/built-ins/Symbol/auto-boxing-strict-strict.js new file mode 100644 index 0000000000..8db71bdf2a --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/auto-boxing-strict-strict.js @@ -0,0 +1,27 @@ +'use strict'; +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4 +description: > + Symbol ToObject auto-boxing +flags: [onlyStrict] +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + var sym = Symbol('66'); + sym.a = 0; +}); + +assert.throws(TypeError, function() { + var sym = Symbol('66'); + sym['a' + 'b'] = 0; +}); + +assert.throws(TypeError, function() { + var sym = Symbol('66'); + sym[62] = 0; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/browser.js b/js/src/tests/test262/built-ins/Symbol/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/constructor.js b/js/src/tests/test262/built-ins/Symbol/constructor.js new file mode 100644 index 0000000000..dc620b4271 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/constructor.js @@ -0,0 +1,20 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.1 +description: > + Symbol constructor +features: [Symbol] +---*/ +assert.sameValue( + Object.getPrototypeOf(Symbol('66')).constructor, + Symbol, + "The value of `Object.getPrototypeOf(Symbol('66')).constructor` is `Symbol`" +); +assert.sameValue( + Object.getPrototypeOf(Object(Symbol('66'))).constructor, + Symbol, + "The value of `Object.getPrototypeOf(Object(Symbol('66'))).constructor` is `Symbol`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/desc-to-string-symbol.js b/js/src/tests/test262/built-ins/Symbol/desc-to-string-symbol.js new file mode 100644 index 0000000000..6713dc321c --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/desc-to-string-symbol.js @@ -0,0 +1,21 @@ +// 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-symbol-constructor +description: The first argument is coerced to a String value (from a Symbol) +info: | + 1. If NewTarget is not undefined, throw a TypeError exception. + 2. If description is undefined, let descString be undefined. + 2. Else, let descString be ? ToString(description). + 3. Return a new unique Symbol value whose [[Description]] value is + descString. +features: [Symbol] +---*/ + +var s = Symbol('1'); + +assert.throws(TypeError, function() { + Symbol(s); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/desc-to-string.js b/js/src/tests/test262/built-ins/Symbol/desc-to-string.js new file mode 100644 index 0000000000..ce07b4bdfa --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/desc-to-string.js @@ -0,0 +1,92 @@ +// 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-symbol-constructor +description: The first argument is coerced to a String value (from an object) +info: | + 1. If NewTarget is not undefined, throw a TypeError exception. + 2. If description is undefined, let descString be undefined. + 2. Else, let descString be ? ToString(description). + 3. Return a new unique Symbol value whose [[Description]] value is + descString. +features: [Symbol] +---*/ + +var calls, val; + +val = { + toString: function() { + calls += 'toString'; + return {}; + }, + valueOf: function() { + calls += 'valueOf'; + } +}; + +calls = ''; +Symbol(val); +assert.sameValue(calls, 'toStringvalueOf'); + +val = { + toString: function() { + calls += 'toString'; + }, + valueOf: function() { + calls += 'valueOf'; + } +}; + +calls = ''; +Symbol(val); +assert.sameValue(calls, 'toString'); + +val = { + toString: null, + valueOf: function() { + calls += 'valueOf'; + } +}; + +calls = ''; +Symbol(val); +assert.sameValue(calls, 'valueOf'); + +val = { + toString: null, + valueOf: function() { + calls += 'valueOf'; + return {}; + } +}; + +calls = ''; +assert.throws(TypeError, function() { + Symbol(val); +}, '`toString` is not callable, and `valueOf` returns a non-primitive value'); +assert.sameValue( + calls, 'valueOf', 'invocation pattern for non-callable `toString`' +); + +val = { + toString: function() { + calls += 'toString'; + return {}; + }, + valueOf: function() { + calls += 'valueOf'; + return {}; + } +}; + +calls = ''; +assert.throws(TypeError, function() { + Symbol(val); +}, '`toString` nor `valueOf` both return non-primitive values'); +assert.sameValue( + calls, + 'toStringvalueOf', + 'invocation pattern for non-callable `toString` and `valueOf`' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/browser.js b/js/src/tests/test262/built-ins/Symbol/for/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/for/create-value.js b/js/src/tests/test262/built-ins/Symbol/for/create-value.js new file mode 100644 index 0000000000..68eabf199b --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/create-value.js @@ -0,0 +1,26 @@ +// 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-symbol.for +description: Creation of a unique Symbol value +info: | + 1. Let stringKey be ? ToString(key). + 2. For each element e of the GlobalSymbolRegistry List, + a. If SameValue(e.[[Key]], stringKey) is true, return e.[[Symbol]]. + 3. Assert: GlobalSymbolRegistry does not currently contain an entry for + stringKey. + 4. Let newSymbol be a new unique Symbol value whose [[Description]] value + is stringKey. + 5. Append the Record { [[Key]]: stringKey, [[Symbol]]: newSymbol } to the + GlobalSymbolRegistry List. + 6. Return newSymbol. +features: [Symbol] +---*/ + +var canonical = Symbol.for('s'); + +assert.sameValue(typeof canonical, 'symbol'); +assert.notSameValue(canonical, Symbol('s')); +assert.notSameValue(canonical, Symbol.for('y')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/for/cross-realm.js new file mode 100644 index 0000000000..072ab74124 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/cross-realm.js @@ -0,0 +1,21 @@ +// 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-symbol.for +description: Global symbol registry is shared by all realms +info: | + The GlobalSymbolRegistry is a List that is globally available. It is shared + by all realms. Prior to the evaluation of any ECMAScript code it is + initialized as a new empty List. +features: [cross-realm, Symbol] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; +var parent = Symbol.for('parent'); +var child = OSymbol.for('child'); + +assert.notSameValue(Symbol.for, OSymbol.for); +assert.sameValue(parent, OSymbol.for('parent')); +assert.sameValue(Symbol.for('child'), child); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/description.js b/js/src/tests/test262/built-ins/Symbol/for/description.js new file mode 100644 index 0000000000..0a2b007626 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/description.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-symbol.for +description: Assigns the string value to the [[Description]] slot +info: | + 1. Let stringKey be ? ToString(key). + [...] + 4. Let newSymbol be a new unique Symbol value whose [[Description]] value + is stringKey. + [...] + 6. Return newSymbol. +features: [Symbol, Symbol.prototype.description] +---*/ + +var symbol = Symbol.for({toString: function() { return 'test262'; }}); + +assert.sameValue(symbol.description, 'test262'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/length.js b/js/src/tests/test262/built-ins/Symbol/for/length.js new file mode 100644 index 0000000000..5875d22702 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/length.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.2.1 +description: > + Symbol.for.length is 1. +info: | + Symbol.for ( key ) + + 17 ECMAScript Standard Built-in Objects: + 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. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.for.length, 1); + +verifyNotEnumerable(Symbol.for, "length"); +verifyNotWritable(Symbol.for, "length"); +verifyConfigurable(Symbol.for, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/name.js b/js/src/tests/test262/built-ins/Symbol/for/name.js new file mode 100644 index 0000000000..fce43732c0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.2.1 +description: > + Symbol.for.name is "for". +info: | + Symbol.for ( key ) + + 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, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.for.name, "for"); + +verifyNotEnumerable(Symbol.for, "name"); +verifyNotWritable(Symbol.for, "name"); +verifyConfigurable(Symbol.for, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/not-a-constructor.js b/js/src/tests/test262/built-ins/Symbol/for/not-a-constructor.js new file mode 100644 index 0000000000..a90a09e9a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Symbol.for does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, Symbol, arrow-function] +---*/ + +assert.sameValue(isConstructor(Symbol.for), false, 'isConstructor(Symbol.for) must return false'); + +assert.throws(TypeError, () => { + new Symbol.for(); +}, '`new Symbol.for()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/for/prop-desc.js new file mode 100644 index 0000000000..119799e90b --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/prop-desc.js @@ -0,0 +1,20 @@ +// 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-symbol.for +description: Property descriptor +info: | + 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. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(typeof Symbol.for, 'function'); + +verifyNotEnumerable(Symbol, 'for'); +verifyWritable(Symbol, 'for'); +verifyConfigurable(Symbol, 'for'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/retrieve-value.js b/js/src/tests/test262/built-ins/Symbol/for/retrieve-value.js new file mode 100644 index 0000000000..444b525038 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/retrieve-value.js @@ -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-symbol.for +description: Retrieval of previously-created value +info: | + 1. Let stringKey be ? ToString(key). + 2. For each element e of the GlobalSymbolRegistry List, + a. If SameValue(e.[[Key]], stringKey) is true, return e.[[Symbol]]. + 3. Assert: GlobalSymbolRegistry does not currently contain an entry for + stringKey. + 4. Let newSymbol be a new unique Symbol value whose [[Description]] value + is stringKey. + 5. Append the Record { [[Key]]: stringKey, [[Symbol]]: newSymbol } to the + GlobalSymbolRegistry List. + 6. Return newSymbol. +features: [Symbol] +---*/ + +var canonical = Symbol.for('s'); + +assert.sameValue(typeof canonical, 'symbol'); +assert.sameValue(canonical, Symbol.for('s')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/for/shell.js b/js/src/tests/test262/built-ins/Symbol/for/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/for/to-string-err.js b/js/src/tests/test262/built-ins/Symbol/for/to-string-err.js new file mode 100644 index 0000000000..9cd2a121a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/for/to-string-err.js @@ -0,0 +1,27 @@ +// 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-symbol.for +description: Error resulting from string coercion of first argument +info: | + 1. Let stringKey be ? ToString(key). +features: [Symbol] +---*/ + +var subject = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + Symbol.for(subject); +}); + +subject = Symbol('s'); + +assert.throws(TypeError, function() { + Symbol.for(subject); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/hasInstance/browser.js b/js/src/tests/test262/built-ins/Symbol/hasInstance/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/hasInstance/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/hasInstance/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/hasInstance/cross-realm.js new file mode 100644 index 0000000000..822728081c --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/hasInstance/cross-realm.js @@ -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-symbol.hasinstance +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.hasInstance] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.hasInstance, OSymbol.hasInstance); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/hasInstance/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/hasInstance/prop-desc.js new file mode 100644 index 0000000000..94306fe5bc --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/hasInstance/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.2 +description: Property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.hasInstance] +---*/ + +assert.sameValue(typeof Symbol.hasInstance, 'symbol'); +verifyNotEnumerable(Symbol, 'hasInstance'); +verifyNotWritable(Symbol, 'hasInstance'); +verifyNotConfigurable(Symbol, 'hasInstance'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/hasInstance/shell.js b/js/src/tests/test262/built-ins/Symbol/hasInstance/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/hasInstance/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/invoked-with-new.js b/js/src/tests/test262/built-ins/Symbol/invoked-with-new.js new file mode 100644 index 0000000000..0ab96a9636 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/invoked-with-new.js @@ -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-symbol-constructor +description: The Symbol constructor may not be invoked with `new` +info: | + 1. If NewTarget is not undefined, throw a TypeError exception. +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + new Symbol(); +}); + +assert.throws(TypeError, function() { + new Symbol('1'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/is-constructor.js b/js/src/tests/test262/built-ins/Symbol/is-constructor.js new file mode 100644 index 0000000000..b7b730e01b --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/is-constructor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-symbol-constructor +description: > + Symbol is a constructor and has [[Construct]] internal method. +info: | + The Symbol constructor: + [...] + * may be used as the value of an extends clause of a class definition + but a super call to it will cause an exception. + [...] + * has a [[Prototype]] internal slot whose value is %Function.prototype%. +includes: [isConstructor.js] +features: [Symbol, Reflect.construct] +---*/ + +assert(isConstructor(Symbol)); +assert.sameValue(Object.getPrototypeOf(Symbol), Function.prototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/browser.js b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/cross-realm.js new file mode 100644 index 0000000000..e14f02ec67 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/cross-realm.js @@ -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-symbol.isconcatspreadable +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.isConcatSpreadable] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.isConcatSpreadable, OSymbol.isConcatSpreadable); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/prop-desc.js new file mode 100644 index 0000000000..14156f4c76 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.3 +description: Property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.isConcatSpreadable] +---*/ + +assert.sameValue(typeof Symbol.isConcatSpreadable, 'symbol'); +verifyNotEnumerable(Symbol, 'isConcatSpreadable'); +verifyNotWritable(Symbol, 'isConcatSpreadable'); +verifyNotConfigurable(Symbol, 'isConcatSpreadable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/shell.js b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/isConcatSpreadable/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/iterator/browser.js b/js/src/tests/test262/built-ins/Symbol/iterator/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/iterator/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/iterator/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/iterator/cross-realm.js new file mode 100644 index 0000000000..325c53447d --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/iterator/cross-realm.js @@ -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-symbol.iterator +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.iterator] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.iterator, OSymbol.iterator); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/iterator/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/iterator/prop-desc.js new file mode 100644 index 0000000000..1c1de15dda --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/iterator/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.4 +description: > + `Symbol.iterator` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.iterator] +---*/ + +assert.sameValue(typeof Symbol.iterator, 'symbol'); +verifyNotEnumerable(Symbol, 'iterator'); +verifyNotWritable(Symbol, 'iterator'); +verifyNotConfigurable(Symbol, 'iterator'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/iterator/shell.js b/js/src/tests/test262/built-ins/Symbol/iterator/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/iterator/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/arg-non-symbol.js b/js/src/tests/test262/built-ins/Symbol/keyFor/arg-non-symbol.js new file mode 100644 index 0000000000..3b5b793299 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/arg-non-symbol.js @@ -0,0 +1,47 @@ +// 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-symbol.keyfor +description: Called with a non-symbol argument +info: | + 1. If Type(sym) is not Symbol, throw a TypeError exception. +features: [Symbol] +---*/ + +assert.sameValue(typeof Symbol.keyFor, 'function'); + +assert.throws(TypeError, function() { + Symbol.keyFor(null); +}, 'null'); + +assert.throws(TypeError, function() { + Symbol.keyFor(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + Symbol.keyFor('1'); +}, 'number'); + +assert.throws(TypeError, function() { + Symbol.keyFor(''); +}, 'string'); + +assert.throws(TypeError, function() { + Symbol.keyFor({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + Symbol.keyFor([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + Symbol.keyFor(arguments); +}, 'arguments exotic object'); + +var subject = Object(Symbol('s')); + +assert.throws(TypeError, function() { + Symbol.keyFor(subject); +}, 'symbol object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/arg-symbol-registry-hit.js b/js/src/tests/test262/built-ins/Symbol/keyFor/arg-symbol-registry-hit.js new file mode 100644 index 0000000000..f3019ec719 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/arg-symbol-registry-hit.js @@ -0,0 +1,17 @@ +// 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-symbol.keyfor +description: Called with Symbol value that exists in the global symbol registry +info: | + 1. If Type(sym) is not Symbol, throw a TypeError exception. + 2. For each element e of the GlobalSymbolRegistry List (see 19.4.2.1), + a. If SameValue(e.[[Symbol]], sym) is true, return e.[[Key]]. +features: [Symbol] +---*/ + +var canonical = Symbol.for('s'); + +assert.sameValue(Symbol.keyFor(canonical), 's'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/arg-symbol-registry-miss.js b/js/src/tests/test262/built-ins/Symbol/keyFor/arg-symbol-registry-miss.js new file mode 100644 index 0000000000..48bb621536 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/arg-symbol-registry-miss.js @@ -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-symbol.keyfor +description: > + Called with Symbol value that does not exist in the global symbol registry +info: | + 1. If Type(sym) is not Symbol, throw a TypeError exception. + 2. For each element e of the GlobalSymbolRegistry List (see 19.4.2.1), + a. If SameValue(e.[[Symbol]], sym) is true, return e.[[Key]]. + 3. Assert: GlobalSymbolRegistry does not currently contain an entry for + sym. + 4. Return undefined. +features: [Symbol.iterator, Symbol] +---*/ + +var constructed = Symbol('Symbol.iterator'); +assert.sameValue(Symbol.keyFor(constructed), undefined, 'constructed symbol'); + +assert.sameValue( + Symbol.keyFor(Symbol.iterator), undefined, 'well-known symbol' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/browser.js b/js/src/tests/test262/built-ins/Symbol/keyFor/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/keyFor/cross-realm.js new file mode 100644 index 0000000000..a052c994c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/cross-realm.js @@ -0,0 +1,21 @@ +// 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-symbol.keyfor +description: Global symbol registry is shared by all realms +info: | + The GlobalSymbolRegistry is a List that is globally available. It is shared + by all realms. Prior to the evaluation of any ECMAScript code it is + initialized as a new empty List. +features: [cross-realm, Symbol] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; +var parent = Symbol.for('parent'); +var child = OSymbol.for('child'); + +assert.notSameValue(Symbol.keyFor, OSymbol.keyFor); +assert.sameValue(OSymbol.keyFor(parent), 'parent'); +assert.sameValue(Symbol.keyFor(child), 'child'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/length.js b/js/src/tests/test262/built-ins/Symbol/keyFor/length.js new file mode 100644 index 0000000000..8f1296daf6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/length.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.2.5 +description: > + Symbol.keyFor.length is 1. +info: | + Symbol.keyFor ( sym ) + + 17 ECMAScript Standard Built-in Objects: + 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. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.keyFor.length, 1); + +verifyNotEnumerable(Symbol.keyFor, "length"); +verifyNotWritable(Symbol.keyFor, "length"); +verifyConfigurable(Symbol.keyFor, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/name.js b/js/src/tests/test262/built-ins/Symbol/keyFor/name.js new file mode 100644 index 0000000000..10adeeb674 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.2.5 +description: > + Symbol.keyFor.name is "keyFor". +info: | + Symbol.keyFor ( sym ) + + 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, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.keyFor.name, "keyFor"); + +verifyNotEnumerable(Symbol.keyFor, "name"); +verifyNotWritable(Symbol.keyFor, "name"); +verifyConfigurable(Symbol.keyFor, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/not-a-constructor.js b/js/src/tests/test262/built-ins/Symbol/keyFor/not-a-constructor.js new file mode 100644 index 0000000000..61d6b676d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Symbol.keyFor does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, Symbol, arrow-function] +---*/ + +assert.sameValue(isConstructor(Symbol.keyFor), false, 'isConstructor(Symbol.keyFor) must return false'); + +assert.throws(TypeError, () => { + new Symbol.keyFor(Symbol()); +}, '`new Symbol.keyFor(Symbol())` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/keyFor/prop-desc.js new file mode 100644 index 0000000000..97603d9e79 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/prop-desc.js @@ -0,0 +1,20 @@ +// 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-symbol.keyfor +description: Property descriptor +info: | + 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. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(typeof Symbol.keyFor, 'function'); + +verifyNotEnumerable(Symbol, 'keyFor'); +verifyWritable(Symbol, 'keyFor'); +verifyConfigurable(Symbol, 'keyFor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/keyFor/shell.js b/js/src/tests/test262/built-ins/Symbol/keyFor/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/keyFor/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/length.js b/js/src/tests/test262/built-ins/Symbol/length.js new file mode 100644 index 0000000000..f50c96667d --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/length.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol-constructor +description: > + Properties of the Symbol Constructor + + Besides the length property (whose value is 0) + +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.length, 0, "The value of `Symbol.length` is `0`"); + +verifyNotEnumerable(Symbol, "length"); +verifyNotWritable(Symbol, "length"); +verifyConfigurable(Symbol, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/match/browser.js b/js/src/tests/test262/built-ins/Symbol/match/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/match/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/match/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/match/cross-realm.js new file mode 100644 index 0000000000..60dc6ccdf4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/match/cross-realm.js @@ -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-symbol.match +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.match] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.match, OSymbol.match); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/match/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/match/prop-desc.js new file mode 100644 index 0000000000..726bf12cab --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/match/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.6 +description: > + `Symbol.match` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.match] +---*/ + +assert.sameValue(typeof Symbol.match, 'symbol'); +verifyNotEnumerable(Symbol, 'match'); +verifyNotWritable(Symbol, 'match'); +verifyNotConfigurable(Symbol, 'match'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/match/shell.js b/js/src/tests/test262/built-ins/Symbol/match/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/match/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/matchAll/browser.js b/js/src/tests/test262/built-ins/Symbol/matchAll/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/matchAll/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/matchAll/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/matchAll/cross-realm.js new file mode 100644 index 0000000000..7fe4c2a532 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/matchAll/cross-realm.js @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Peter Wong. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.matchAll] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.matchAll, OSymbol.matchAll); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/matchAll/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/matchAll/prop-desc.js new file mode 100644 index 0000000000..e0f76d1c7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/matchAll/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Peter Wong. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: | + `Symbol.matchAll` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.matchAll] +---*/ + +assert.sameValue(typeof Symbol.matchAll, 'symbol'); +verifyNotEnumerable(Symbol, 'matchAll'); +verifyNotWritable(Symbol, 'matchAll'); +verifyNotConfigurable(Symbol, 'matchAll'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/matchAll/shell.js b/js/src/tests/test262/built-ins/Symbol/matchAll/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/matchAll/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/name.js b/js/src/tests/test262/built-ins/Symbol/name.js new file mode 100644 index 0000000000..c639fc142d --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/name.js @@ -0,0 +1,19 @@ +// Copyright (C) 2017 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol-constructor +description: > + Symbol ( [ description ] ) + +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.name, "Symbol", "The value of `Symbol.name` is `'Symbol'`"); + +verifyNotEnumerable(Symbol, "name"); +verifyNotWritable(Symbol, "name"); +verifyConfigurable(Symbol, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/not-callable.js b/js/src/tests/test262/built-ins/Symbol/not-callable.js new file mode 100644 index 0000000000..56fe2a3749 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/not-callable.js @@ -0,0 +1,36 @@ +// Copyright (C) 2019 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-properties-of-symbol-instances +description: > + Symbol primitives and objects are not callable. +info: | + Properties of Symbol Instances + + Symbol instances are ordinary objects that inherit properties from the + Symbol prototype object. Symbol instances have a [[SymbolData]] internal slot. + The [[SymbolData]] internal slot is the Symbol value represented by this + Symbol object. +features: [Symbol] +---*/ + +var sym = Symbol('desc'); +var symObj = Object(Symbol()); + +assert.throws(TypeError, function() { + sym(); +}); + +assert.throws(TypeError, function() { + new sym(); +}); + +assert.throws(TypeError, function() { + symObj(); +}); + +assert.throws(TypeError, function() { + new symObj(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/browser.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/length.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/length.js new file mode 100644 index 0000000000..b2cf331005 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.4 +description: Symbol.prototype[Symbol.toPrimitive] `length` property +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 }. +features: [Symbol.toPrimitive] +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Symbol.prototype[Symbol.toPrimitive].length, 1); + +verifyNotEnumerable(Symbol.prototype[Symbol.toPrimitive], 'length'); +verifyNotWritable(Symbol.prototype[Symbol.toPrimitive], 'length'); +verifyConfigurable(Symbol.prototype[Symbol.toPrimitive], 'length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/name.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/name.js new file mode 100644 index 0000000000..58579822e7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.4 +description: Symbol.prototype[Symbol.toPrimitive] `name` property +info: | + The value of the name property of this function is "[Symbol.toPrimitive]". + + ES6 Section 17: + + [...] + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +features: [Symbol.toPrimitive] +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + Symbol.prototype[Symbol.toPrimitive].name, '[Symbol.toPrimitive]' +); + +verifyNotEnumerable(Symbol.prototype[Symbol.toPrimitive], 'name'); +verifyNotWritable(Symbol.prototype[Symbol.toPrimitive], 'name'); +verifyConfigurable(Symbol.prototype[Symbol.toPrimitive], 'name'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/prop-desc.js new file mode 100644 index 0000000000..e4dc9ef2c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.3.4 +description: Symbol.prototype[Symbol.toPrimitive] property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toPrimitive] +---*/ + +verifyNotEnumerable(Symbol.prototype, Symbol.toPrimitive); +verifyNotWritable(Symbol.prototype, Symbol.toPrimitive); +verifyConfigurable(Symbol.prototype, Symbol.toPrimitive); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/redefined-symbol-wrapper-ordinary-toprimitive.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/redefined-symbol-wrapper-ordinary-toprimitive.js new file mode 100644 index 0000000000..365b97f782 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/redefined-symbol-wrapper-ordinary-toprimitive.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-symbol.prototype-@@toprimitive +description: > + If redefined to nullish value, Symbol wrapper object is converted to primitive + via OrdinaryToPrimitive. +info: | + ToPrimitive ( input [ , preferredType ] ) + + [...] + 2. If Type(input) is Object, then + a. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + b. If exoticToPrim is not undefined, then + [...] + c. If preferredType is not present, let preferredType be number. + d. Return ? OrdinaryToPrimitive(input, preferredType). +features: [Symbol.toPrimitive] +---*/ + +Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, { value: null }); + +assert.sameValue(Object(Symbol()) == "Symbol()", false, "hint: default"); +assert.throws(TypeError, () => { +Object(Symbol()); }, "hint: number"); +assert.sameValue(`${Object(Symbol())}`, "Symbol()", "hint: string"); + +Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, { value: undefined }); + +assert(Object(Symbol.iterator) == Symbol.iterator, "hint: default"); +assert.throws(TypeError, () => { Object(Symbol()) <= ""; }, "hint: number"); +assert.sameValue({ "Symbol()": 1 }[Object(Symbol())], 1, "hint: string"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/removed-symbol-wrapper-ordinary-toprimitive.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/removed-symbol-wrapper-ordinary-toprimitive.js new file mode 100644 index 0000000000..c5b22e3d7d --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/removed-symbol-wrapper-ordinary-toprimitive.js @@ -0,0 +1,85 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-symbol.prototype-@@toprimitive +description: > + If deleted, Symbol wrapper objects is converted to primitive via OrdinaryToPrimitive. +info: | + ToPrimitive ( input [ , preferredType ] ) + + [...] + 2. If Type(input) is Object, then + a. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + b. If exoticToPrim is not undefined, then + [...] + c. If preferredType is not present, let preferredType be number. + d. Return ? OrdinaryToPrimitive(input, preferredType). +features: [Symbol.toPrimitive] +---*/ + +assert(delete Symbol.prototype[Symbol.toPrimitive]); + +let valueOfGets = 0; +let valueOfCalls = 0; +let valueOfFunction = () => { ++valueOfCalls; return 123; }; +Object.defineProperty(Symbol.prototype, "valueOf", { + get: () => { ++valueOfGets; return valueOfFunction; }, +}); + +assert(Object(Symbol()) == 123, "hint: default"); +assert.sameValue(Object(Symbol()) - 0, 123, "hint: number"); +assert.sameValue("".concat(Object(Symbol())), "Symbol()", "hint: string"); + +assert.sameValue(valueOfGets, 2); +assert.sameValue(valueOfCalls, 2); + +let toStringGets = 0; +let toStringCalls = 0; +let toStringFunction = () => { ++toStringCalls; return "foo"; }; +Object.defineProperty(Symbol.prototype, "toString", { + get: () => { ++toStringGets; return toStringFunction; }, +}); + +assert.sameValue("" + Object(Symbol()), "123", "hint: default"); +assert.sameValue(Object(Symbol()) * 1, 123, "hint: number"); +assert.sameValue({ "123": 1, "Symbol()": 2, "foo": 3 }[Object(Symbol())], 3, "hint: string"); + +assert.sameValue(valueOfGets, 4); +assert.sameValue(valueOfCalls, 4); +assert.sameValue(toStringGets, 1); +assert.sameValue(toStringCalls, 1); + +valueOfFunction = null; + +assert.sameValue(new Date(Object(Symbol())).getTime(), NaN, "hint: default"); +assert.sameValue(+Object(Symbol()), NaN, "hint: number"); +assert.sameValue(`${Object(Symbol())}`, "foo", "hint: string"); + +assert.sameValue(valueOfGets, 6); +assert.sameValue(valueOfCalls, 4); +assert.sameValue(toStringGets, 4); +assert.sameValue(toStringCalls, 4); + +toStringFunction = function() { throw new Test262Error(); }; + +assert.throws(Test262Error, () => { Object(Symbol()) != 123; }, "hint: default"); +assert.throws(Test262Error, () => { Object(Symbol()) / 0; }, "hint: number"); +assert.throws(Test262Error, () => { "".concat(Object(Symbol())); }, "hint: string"); + +assert.sameValue(valueOfGets, 8); +assert.sameValue(valueOfCalls, 4); +assert.sameValue(toStringGets, 7); +assert.sameValue(toStringCalls, 4); + +toStringFunction = undefined; + +assert.throws(TypeError, () => { 1 + Object(Symbol()); }, "hint: default"); +assert.throws(TypeError, () => { Number(Object(Symbol())); }, "hint: number"); +assert.throws(TypeError, () => { String(Object(Symbol())); }, "hint: string"); + +assert.sameValue(valueOfGets, 11); +assert.sameValue(valueOfCalls, 4); +assert.sameValue(toStringGets, 10); +assert.sameValue(toStringCalls, 4); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/shell.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-non-obj.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-non-obj.js new file mode 100644 index 0000000000..ac01982c62 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-non-obj.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.4 +description: Behavior when `this` value is neither a Symbol nor an Object +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. + 3. If Type(s) is not Object, throw a TypeError exception. +features: [Symbol.toPrimitive] +---*/ + +assert.sameValue(typeof Symbol.prototype[Symbol.toPrimitive], 'function'); + +assert.throws(TypeError, function() { + Symbol.prototype[Symbol.toPrimitive].call(undefined); +}); + +assert.throws(TypeError, function() { + Symbol.prototype[Symbol.toPrimitive].call(null); +}); + +assert.throws(TypeError, function() { + Symbol.prototype[Symbol.toPrimitive].call(86); +}); + +assert.throws(TypeError, function() { + Symbol.prototype[Symbol.toPrimitive].call(''); +}); + +assert.throws(TypeError, function() { + Symbol.prototype[Symbol.toPrimitive].call(true); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-obj-non-symbol-wrapper.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-obj-non-symbol-wrapper.js new file mode 100644 index 0000000000..81af657246 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-obj-non-symbol-wrapper.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.4 +description: > + Behavior when `this` value is an object without a [[SymbolData]] internal + slot +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. + 3. If Type(s) is not Object, throw a TypeError exception. + 4. If s does not have a [[SymbolData]] internal slot, throw a TypeError + exception. +features: [Symbol.toPrimitive] +---*/ + +assert.throws(TypeError, function() { + Symbol.prototype[Symbol.toPrimitive].call({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-obj-symbol-wrapper.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-obj-symbol-wrapper.js new file mode 100644 index 0000000000..cb6c764c08 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-obj-symbol-wrapper.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.4 +description: > + Behavior when `this` value is an object with a [[SymbolData]] internal + slot +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. + 3. If Type(s) is not Object, throw a TypeError exception. + 4. If s does not have a [[SymbolData]] internal slot, throw a TypeError + exception. + 5. Return the value of s’s [[SymbolData]] internal slot. +features: [Symbol.toPrimitive] +---*/ + +assert.sameValue( + Object(Symbol.toPrimitive)[Symbol.toPrimitive](), Symbol.toPrimitive +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-symbol.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-symbol.js new file mode 100644 index 0000000000..3aec8491ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toPrimitive/this-val-symbol.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.4 +description: Behavior when `this` value is a Symbol +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. +features: [Symbol.toPrimitive] +---*/ + +assert.sameValue(Symbol.toPrimitive[Symbol.toPrimitive](), Symbol.toPrimitive); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..6090ef88bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/Symbol.toStringTag.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.5 +description: > + `Symbol.toStringTag` property descriptor +info: | + The initial value of the @@toStringTag property is the String value + "Symbol". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Symbol.prototype[Symbol.toStringTag], 'Symbol'); + +verifyNotEnumerable(Symbol.prototype, Symbol.toStringTag); +verifyNotWritable(Symbol.prototype, Symbol.toStringTag); +verifyConfigurable(Symbol.prototype, Symbol.toStringTag); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/browser.js b/js/src/tests/test262/built-ins/Symbol/prototype/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/constructor.js b/js/src/tests/test262/built-ins/Symbol/prototype/constructor.js new file mode 100644 index 0000000000..955fd837f0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/constructor.js @@ -0,0 +1,20 @@ +// 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-symbol.prototype.constructor +description: Property descriptor +info: | + 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. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.prototype.constructor, Symbol); + +verifyNotEnumerable(Symbol.prototype, 'constructor'); +verifyWritable(Symbol.prototype, 'constructor'); +verifyConfigurable(Symbol.prototype, 'constructor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/browser.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js new file mode 100644 index 0000000000..bd0a8bc867 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-symbol.prototype.description +description: > + SymbolDescriptiveString(sym) via Symbol.prototype.toString() +info: | + SymbolDescriptiveString ( sym ) + + Assert: Type(sym) is Symbol. + Let desc be sym's [[Description]] value. + If desc is undefined, let desc be the empty string. + Assert: Type(desc) is String. + Return the string-concatenation of "Symbol(", desc, and ")". + +features: [Symbol.prototype.description] +---*/ + +const symbol = Symbol('foo'); + +assert.sameValue( + symbol.description, + 'foo', + 'The value of symbol.description is "foo"' +); +assert.sameValue( + symbol.toString(), + `Symbol(${symbol.description})`, + `symbol.toString() returns "Symbol(${symbol.description})"` +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/descriptor.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/descriptor.js new file mode 100644 index 0000000000..2f793f7cf3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/descriptor.js @@ -0,0 +1,41 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.prototype.description +description: > + Test the descriptor of Symbol.prototype.description. +info: | + `Symbol.prototype.description` is an accessor property whose + set accessor function is undefined. +includes: [propertyHelper.js] +features: [Symbol.prototype.description] +---*/ + + +var desc = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description'); + +assert.sameValue( + desc.set, + undefined, + 'The value of desc.set is `undefined`' +); + +assert.sameValue( + desc.writable, + undefined, + 'The value of desc.writable is `undefined`' +); + +assert.sameValue( + typeof desc.get, + 'function', + 'The value of `typeof desc.get` is "function"' +); + +verifyProperty(Symbol.prototype, 'description', { + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/get.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/get.js new file mode 100644 index 0000000000..91f007e2e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/get.js @@ -0,0 +1,43 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.prototype.description +description: > + Test the get accessor function of Symbol.prototype.description. +info: | + 1. Let s be the this value. + 2. Let sym be ? thisSymbolValue(s). + 3. Return sym.[[Description]]. +features: [Symbol.prototype.description] +---*/ + +const symbol = Symbol('test'); +assert.sameValue( + symbol.description, + 'test', + 'The value of symbol.description is "test"' +); + +const empty = Symbol(); +assert.sameValue( + empty.description, + undefined, + 'The value of empty.description is `undefined`' +); + +const undef = Symbol(undefined); +assert.sameValue( + undef.description, + undefined, + 'The value of undef.description is `undefined`' +); + +const emptyStr = Symbol(''); +assert.sameValue( + emptyStr.description, + '', + 'The value of emptyStr.description is ""' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/is-not-own-property.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/is-not-own-property.js new file mode 100644 index 0000000000..d5bbe141fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/is-not-own-property.js @@ -0,0 +1,16 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.prototype.description +description: Ensure that 'description' is not an own property of Symbols +features: [Symbol.prototype.description] +---*/ + +assert.sameValue( + Symbol().hasOwnProperty('description'), + false, + 'Symbol().hasOwnProperty("description") returns false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/shell.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/this-val-non-symbol.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/this-val-non-symbol.js new file mode 100644 index 0000000000..8ab9d926f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/this-val-non-symbol.js @@ -0,0 +1,48 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.prototype.description +description: > + Behavior when "this" value is an object without a [[SymbolData]] internal + slot. +info: | + 1. Let s be the this value. + 2. Let sym be ? thisSymbolValue(s). + 3. Return sym.[[Description]]. +features: [Symbol.prototype.description] +---*/ + +const getter = Object.getOwnPropertyDescriptor( + Symbol.prototype, 'description' +).get; + +assert.throws(TypeError, function() { + getter.call(null); +}, 'getter.call(null) throws TypeError'); + +assert.throws(TypeError, function() { + getter.call(123); +}, 'getter.call(123) throws TypeError'); + +assert.throws(TypeError, function() { + getter.call('test'); +}, 'getter.call("test") throws TypeError'); + +assert.throws(TypeError, function() { + getter.call(true); +}, 'getter.call(true) throws TypeError'); + +assert.throws(TypeError, function() { + getter.call(undefined); +}, 'getter.call(undefined) throws TypeError'); + +assert.throws(TypeError, function() { + getter.call(new Proxy({}, {})); +}, 'getter.call(new Proxy({}, {})) throws TypeError'); + +assert.throws(TypeError, function() { + getter.call({}); +}, 'getter.call({}) throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/this-val-symbol.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/this-val-symbol.js new file mode 100644 index 0000000000..e685f777c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/this-val-symbol.js @@ -0,0 +1,67 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.prototype.description +description: > + Test that calling the getter on a Symbol or a Symbol wrapper object works. +info: | + 1. Let s be the this value. + 2. Let sym be ? thisSymbolValue(s). + 3. Return sym.[[Description]]. +features: [Symbol.prototype.description] +---*/ + +const getter = Object.getOwnPropertyDescriptor( + Symbol.prototype, 'description' +).get; + +const symbol = Symbol('test'); +assert.sameValue( + getter.call(symbol), + 'test', + 'getter.call(symbol) returns "test"' +); +assert.sameValue( + getter.call(Object(symbol)), + 'test', + 'getter.call(Object(symbol)) returns "test"' +); + +const empty = Symbol(); +assert.sameValue( + getter.call(empty), + undefined, + 'getter.call(empty) returns `undefined`' +); +assert.sameValue( + getter.call(Object(empty)), + undefined, + 'getter.call(Object(empty)) returns `undefined`' +); + +const undef = Symbol(undefined); +assert.sameValue( + getter.call(undef), + undefined, + 'getter.call(undef) returns `undefined`' +); +assert.sameValue( + getter.call(Object(undef)), + undefined, + 'getter.call(Object(undef)) returns `undefined`' +); + +const emptyStr = Symbol(''); +assert.sameValue( + getter.call(emptyStr), + '', + 'getter.call(emptyStr) returns ""' +); +assert.sameValue( + getter.call(Object(emptyStr)), + '', + 'getter.call(Object(emptyStr)) returns ""' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/wrapper.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/wrapper.js new file mode 100644 index 0000000000..5c7f06d864 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/wrapper.js @@ -0,0 +1,43 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol.prototype.description +description: > + Test Symbol.prototype.description called on wrapper objects. +info: | + 1. Let s be the this value. + 2. Let sym be ? thisSymbolValue(s). + 3. Return sym.[[Description]]. +features: [Symbol.prototype.description] +---*/ + +const symbol = Object(Symbol('test')); +assert.sameValue( + symbol.description, + 'test', + 'The value of symbol.description is "test"' +); + +const empty = Object(Symbol()); +assert.sameValue( + empty.description, + undefined, + 'The value of empty.description is `undefined`' +); + +const undef = Object(Symbol(undefined)); +assert.sameValue( + undef.description, + undefined, + 'The value of undef.description is `undefined`' +); + +const emptyStr = Object(Symbol('')); +assert.sameValue( + emptyStr.description, + '', + 'The value of emptyStr.description is ""' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/intrinsic.js b/js/src/tests/test262/built-ins/Symbol/prototype/intrinsic.js new file mode 100644 index 0000000000..84da0afeef --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/intrinsic.js @@ -0,0 +1,15 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3 +description: > + Symbol prototype +features: [Symbol] +---*/ +assert.sameValue( + Object.getPrototypeOf(Symbol('66')), + Symbol.prototype, + "`Object.getPrototypeOf(Symbol('66'))` returns `Symbol.prototype`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/shell.js b/js/src/tests/test262/built-ins/Symbol/prototype/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/browser.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/length.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/length.js new file mode 100644 index 0000000000..84e95cf747 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/length.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.3.2 +description: > + Symbol.prototype.toString.length is 0. +info: | + Symbol.prototype.toString ( ) + + 17 ECMAScript Standard Built-in Objects: + 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. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.prototype.toString.length, 0); + +verifyNotEnumerable(Symbol.prototype.toString, "length"); +verifyNotWritable(Symbol.prototype.toString, "length"); +verifyConfigurable(Symbol.prototype.toString, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/name.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/name.js new file mode 100644 index 0000000000..705eb779f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.3.2 +description: > + Symbol.prototype.toString.name is "toString". +info: | + Symbol.prototype.toString ( ) + + 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, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.prototype.toString.name, "toString"); + +verifyNotEnumerable(Symbol.prototype.toString, "name"); +verifyNotWritable(Symbol.prototype.toString, "name"); +verifyConfigurable(Symbol.prototype.toString, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/not-a-constructor.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/not-a-constructor.js new file mode 100644 index 0000000000..58914a60d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Symbol.prototype.toString does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, Symbol, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Symbol.prototype.toString), + false, + 'isConstructor(Symbol.prototype.toString) must return false' +); + +assert.throws(TypeError, () => { + let symbol = Symbol(); new symbol.toString(); +}, '`let symbol = Symbol(); new symbol.toString()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/prop-desc.js new file mode 100644 index 0000000000..689b1f3ab8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/prop-desc.js @@ -0,0 +1,20 @@ +// 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-symbol.prototype.tostring +description: Property descriptor +info: | + 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. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(typeof Symbol.prototype.toString, 'function'); + +verifyNotEnumerable(Symbol.prototype, 'toString'); +verifyWritable(Symbol.prototype, 'toString'); +verifyConfigurable(Symbol.prototype, 'toString'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/shell.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString-default-attributes-non-strict.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString-default-attributes-non-strict.js new file mode 100644 index 0000000000..f30864f4ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString-default-attributes-non-strict.js @@ -0,0 +1,19 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4 +description: > + Symbol property get and set, non-strict +flags: [noStrict] +features: [Symbol] +---*/ + +var sym = Symbol('66'); + +sym.toString = 0; +assert.sameValue(sym.toString(), 'Symbol(66)', "`sym.toString()` returns `'Symbol(66)'`, after executing `sym.toString = 0;`"); + +sym.valueOf = 0; +assert.sameValue(sym, sym.valueOf(), "The value of `sym` is `sym.valueOf()`, after executing `sym.valueOf = 0;`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString-default-attributes-strict-strict.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString-default-attributes-strict-strict.js new file mode 100644 index 0000000000..d33a0c6747 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString-default-attributes-strict-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4 +description: > + Symbol property get and set, strict +flags: [onlyStrict] +features: [Symbol] +---*/ + +var sym = Symbol("66"); + +assert.throws(TypeError, function() { + sym.toString = 0; +}); + +assert.throws(TypeError, function() { + sym.valueOf = 0; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString.js new file mode 100644 index 0000000000..bc90108708 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/toString.js @@ -0,0 +1,30 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.2 +description: > + toString operations on Symbols +features: [Symbol] +---*/ +assert.sameValue( + String(Symbol('66')), + 'Symbol(66)', + "`String(Symbol('66'))` returns `'Symbol(66)'`" +) +assert.sameValue( + Symbol('66').toString(), + 'Symbol(66)', + "`Symbol('66').toString()` returns `'Symbol(66)'`" +); +assert.sameValue( + Object(Symbol('66')).toString(), + 'Symbol(66)', + "`Object(Symbol('66')).toString()` returns `'Symbol(66)'`" +); +assert.sameValue( + Symbol.prototype.toString.call(Symbol('66')), + 'Symbol(66)', + "`Symbol.prototype.toString.call(Symbol('66'))` returns `'Symbol(66)'`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/toString/undefined.js b/js/src/tests/test262/built-ins/Symbol/prototype/toString/undefined.js new file mode 100644 index 0000000000..808657dfa8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/toString/undefined.js @@ -0,0 +1,26 @@ +// 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-symbol-constructor +description: The value "undefined" is reported as the empty string +info: | + 1. If NewTarget is not undefined, throw a TypeError exception. + 2. If description is undefined, let descString be undefined. + 2. Else, let descString be ? ToString(description). + 3. Return a new unique Symbol value whose [[Description]] value is + descString. + + 19.4.3.2.1 Runtime Semantics: SymbolDescriptiveString + + 1. Assert: Type(sym) is Symbol. + 2. Let desc be sym's [[Description]] value. + 3. If desc is undefined, let desc be the empty string. + 4. Assert: Type(desc) is String. + 5. Return the result of concatenating the strings "Symbol(", desc, and ")". +features: [Symbol] +---*/ + +assert.sameValue(Symbol().toString(), 'Symbol()', 'implicit value'); +assert.sameValue(Symbol(undefined).toString(), 'Symbol()', 'explicit value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/browser.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/length.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/length.js new file mode 100644 index 0000000000..0134f86d03 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/length.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.3.3 +description: > + Symbol.prototype.valueOf.length is 0. +info: | + Symbol.prototype.valueOf ( ) + + 17 ECMAScript Standard Built-in Objects: + 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. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.prototype.valueOf.length, 0); + +verifyNotEnumerable(Symbol.prototype.valueOf, "length"); +verifyNotWritable(Symbol.prototype.valueOf, "length"); +verifyConfigurable(Symbol.prototype.valueOf, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/name.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/name.js new file mode 100644 index 0000000000..a9104cd8a8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.4.3.3 +description: > + Symbol.prototype.valueOf.name is "valueOf". +info: | + Symbol.prototype.valueOf ( ) + + 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, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(Symbol.prototype.valueOf.name, "valueOf"); + +verifyNotEnumerable(Symbol.prototype.valueOf, "name"); +verifyNotWritable(Symbol.prototype.valueOf, "name"); +verifyConfigurable(Symbol.prototype.valueOf, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/not-a-constructor.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/not-a-constructor.js new file mode 100644 index 0000000000..e9edf778b8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Symbol.prototype.valueOf does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, Symbol, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Symbol.prototype.valueOf), + false, + 'isConstructor(Symbol.prototype.valueOf) must return false' +); + +assert.throws(TypeError, () => { + let symbol = Symbol(); new symbol.valueOf(); +}, '`let symbol = Symbol(); new symbol.valueOf()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/prop-desc.js new file mode 100644 index 0000000000..765157b4be --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/prop-desc.js @@ -0,0 +1,20 @@ +// 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-symbol.prototype.valueof +description: Property descriptor +info: | + 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. +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +assert.sameValue(typeof Symbol.prototype.valueOf, 'function'); + +verifyNotEnumerable(Symbol.prototype, 'valueOf'); +verifyWritable(Symbol.prototype, 'valueOf'); +verifyConfigurable(Symbol.prototype, 'valueOf'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/shell.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-non-obj.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-non-obj.js new file mode 100644 index 0000000000..fe5ee15166 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-non-obj.js @@ -0,0 +1,31 @@ +// 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-symbol.prototype.valueof +description: Called on a value that is neither a Symbol nor an Object +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. + 3. If Type(s) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +var valueOf = Symbol.prototype.valueOf; + +assert.throws(TypeError, function() { + valueOf.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + valueOf.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + valueOf.call(0); +}, 'number'); + +assert.throws(TypeError, function() { + valueOf.call(''); +}, 'string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-obj-non-symbol.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-obj-non-symbol.js new file mode 100644 index 0000000000..876780fb86 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-obj-non-symbol.js @@ -0,0 +1,28 @@ +// 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-symbol.prototype.valueof +description: Called on an Object value that is not a Symbol object +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. + 3. If Type(s) is not Object, throw a TypeError exception. + 4. If s does not have a [[SymbolData]] internal slot, throw a TypeError exception. +features: [Symbol] +---*/ + +var valueOf = Symbol.prototype.valueOf; + +assert.throws(TypeError, function() { + valueOf.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + valueOf.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + valueOf.call(arguments); +}, 'arguments exotic object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-obj-symbol.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-obj-symbol.js new file mode 100644 index 0000000000..1a992371b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-obj-symbol.js @@ -0,0 +1,21 @@ +// 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-symbol.prototype.valueof +description: Called on a Symbol Object value +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. + 3. If Type(s) is not Object, throw a TypeError exception. + 4. If s does not have a [[SymbolData]] internal slot, throw a TypeError exception. + 5. Return the value of s's [[SymbolData]] internal slot. +features: [Symbol] +---*/ + +var valueOf = Symbol.prototype.valueOf; +var symbol = Symbol('s'); +var symbolObject = Object(symbol); + +assert.sameValue(valueOf.call(symbolObject), symbol); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-symbol.js b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-symbol.js new file mode 100644 index 0000000000..7bea7e00e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/valueOf/this-val-symbol.js @@ -0,0 +1,17 @@ +// 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-symbol.prototype.valueof +description: Called on a Symbol value +info: | + 1. Let s be the this value. + 2. If Type(s) is Symbol, return s. +features: [Symbol] +---*/ + +var valueOf = Symbol.prototype.valueOf; +var subject = Symbol('s'); + +assert.sameValue(valueOf.call(subject), subject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/replace/browser.js b/js/src/tests/test262/built-ins/Symbol/replace/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/replace/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/replace/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/replace/cross-realm.js new file mode 100644 index 0000000000..4b0cfe4363 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/replace/cross-realm.js @@ -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-symbol.replace +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.replace] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.replace, OSymbol.replace); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/replace/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/replace/prop-desc.js new file mode 100644 index 0000000000..c6dcfa64e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/replace/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.8 +description: > + `Symbol.replace` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.replace] +---*/ + +assert.sameValue(typeof Symbol.replace, 'symbol'); +verifyNotEnumerable(Symbol, 'replace'); +verifyNotWritable(Symbol, 'replace'); +verifyNotConfigurable(Symbol, 'replace'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/replace/shell.js b/js/src/tests/test262/built-ins/Symbol/replace/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/replace/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/search/browser.js b/js/src/tests/test262/built-ins/Symbol/search/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/search/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/search/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/search/cross-realm.js new file mode 100644 index 0000000000..f6e015cbcd --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/search/cross-realm.js @@ -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-symbol.search +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.search] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.search, OSymbol.search); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/search/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/search/prop-desc.js new file mode 100644 index 0000000000..d96d5470df --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/search/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.9 +description: > + `Symbol.search` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.search] +---*/ + +assert.sameValue(typeof Symbol.search, 'symbol'); +verifyNotEnumerable(Symbol, 'search'); +verifyNotWritable(Symbol, 'search'); +verifyNotConfigurable(Symbol, 'search'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/search/shell.js b/js/src/tests/test262/built-ins/Symbol/search/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/search/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/shell.js b/js/src/tests/test262/built-ins/Symbol/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Symbol/species/basic.js b/js/src/tests/test262/built-ins/Symbol/species/basic.js new file mode 100644 index 0000000000..cb6e400e02 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/species/basic.js @@ -0,0 +1,21 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + Symbol.species is a well-known symbol +es6id: 19.4.2.10 +author: Sam Mikes +description: Symbol.species exists +includes: [propertyHelper.js] +features: [Symbol.species] +---*/ + +assert(Symbol !== undefined, "Symbol exists"); +assert(Symbol.species !== undefined, "Symbol.species exists"); + +verifyNotWritable(Symbol, "species"); +verifyNotEnumerable(Symbol, "species"); +verifyNotConfigurable(Symbol, "species"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/species/browser.js b/js/src/tests/test262/built-ins/Symbol/species/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/species/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/species/builtin-getter-name.js b/js/src/tests/test262/built-ins/Symbol/species/builtin-getter-name.js new file mode 100644 index 0000000000..265aea7850 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/species/builtin-getter-name.js @@ -0,0 +1,24 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + ES6 spec 'get [Symbol.species]' +es6id: 21.2.4.2, 22.1.2.5, 22.2.2.4, 23.1.2.2, 23.2.2.2 +author: Sam Mikes +description: Symbol.species getters have defined names +features: [Symbol.species] +---*/ + +function getGetterName(obj, name) { + var getter = Object.getOwnPropertyDescriptor(obj, Symbol.species).get; + return getter && getter.name; +} + +assert.sameValue(getGetterName(Array, Symbol.species), "get [Symbol.species]"); +assert.sameValue(getGetterName(Map, Symbol.species), "get [Symbol.species]"); +assert.sameValue(getGetterName(Promise, Symbol.species), "get [Symbol.species]"); +assert.sameValue(getGetterName(RegExp, Symbol.species), "get [Symbol.species]"); +assert.sameValue(getGetterName(Set, Symbol.species), "get [Symbol.species]"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/species/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/species/cross-realm.js new file mode 100644 index 0000000000..631047c91a --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/species/cross-realm.js @@ -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-symbol.species +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.species] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.species, OSymbol.species); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/species/shell.js b/js/src/tests/test262/built-ins/Symbol/species/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/species/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/species/subclassing.js b/js/src/tests/test262/built-ins/Symbol/species/subclassing.js new file mode 100644 index 0000000000..45aceb514d --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/species/subclassing.js @@ -0,0 +1,16 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + Symbol.species is retained on subclassing +author: Sam Mikes +description: Symbol.species is retained on subclassing +features: [Symbol.species] +---*/ + +class MyRegExp extends RegExp {}; + +assert.sameValue(MyRegExp[Symbol.species], MyRegExp); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/split/browser.js b/js/src/tests/test262/built-ins/Symbol/split/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/split/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/split/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/split/cross-realm.js new file mode 100644 index 0000000000..975c57a8e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/split/cross-realm.js @@ -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-symbol.split +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.split] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.split, OSymbol.split); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/split/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/split/prop-desc.js new file mode 100644 index 0000000000..f40ef13a5b --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/split/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.11 +description: > + `Symbol.split` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.split] +---*/ + +assert.sameValue(typeof Symbol.split, 'symbol'); +verifyNotEnumerable(Symbol, 'split'); +verifyNotWritable(Symbol, 'split'); +verifyNotConfigurable(Symbol, 'split'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/split/shell.js b/js/src/tests/test262/built-ins/Symbol/split/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/split/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/symbol.js b/js/src/tests/test262/built-ins/Symbol/symbol.js new file mode 100644 index 0000000000..4cabedea73 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/symbol.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-symbol-constructor +description: > + The Symbol constructor is the %Symbol% intrinsic object and the initial + value of the Symbol property of the global object. + +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +verifyNotEnumerable(this, "Symbol"); +verifyWritable(this, "Symbol"); +verifyConfigurable(this, "Symbol"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/toPrimitive/browser.js b/js/src/tests/test262/built-ins/Symbol/toPrimitive/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toPrimitive/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/toPrimitive/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/toPrimitive/cross-realm.js new file mode 100644 index 0000000000..1fea1d6e3b --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toPrimitive/cross-realm.js @@ -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-symbol.toprimitive +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.split] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.split, OSymbol.split); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/toPrimitive/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/toPrimitive/prop-desc.js new file mode 100644 index 0000000000..d919618237 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toPrimitive/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.12 +description: > + `Symbol.toPrimitive` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.toPrimitive] +---*/ + +assert.sameValue(typeof Symbol.toPrimitive, 'symbol'); +verifyNotEnumerable(Symbol, 'toPrimitive'); +verifyNotWritable(Symbol, 'toPrimitive'); +verifyNotConfigurable(Symbol, 'toPrimitive'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/toPrimitive/shell.js b/js/src/tests/test262/built-ins/Symbol/toPrimitive/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toPrimitive/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/toStringTag/browser.js b/js/src/tests/test262/built-ins/Symbol/toStringTag/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toStringTag/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/toStringTag/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/toStringTag/cross-realm.js new file mode 100644 index 0000000000..57038d694c --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toStringTag/cross-realm.js @@ -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-symbol.tostringtag +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.toStringTag] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.toStringTag, OSymbol.toStringTag); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/toStringTag/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/toStringTag/prop-desc.js new file mode 100644 index 0000000000..e55efdd3e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toStringTag/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.13 +description: > + `Symbol.toStringTag` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(typeof Symbol.toStringTag, 'symbol'); +verifyNotEnumerable(Symbol, 'toStringTag'); +verifyNotWritable(Symbol, 'toStringTag'); +verifyNotConfigurable(Symbol, 'toStringTag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/toStringTag/shell.js b/js/src/tests/test262/built-ins/Symbol/toStringTag/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/toStringTag/shell.js diff --git a/js/src/tests/test262/built-ins/Symbol/uniqueness.js b/js/src/tests/test262/built-ins/Symbol/uniqueness.js new file mode 100644 index 0000000000..bace068c54 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/uniqueness.js @@ -0,0 +1,20 @@ +// 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-symbol-constructor +description: The Symbol constructor returns a unique value +info: | + 1. If NewTarget is not undefined, throw a TypeError exception. + 2. If description is undefined, let descString be undefined. + 2. Else, let descString be ? ToString(description). + 3. Return a new unique Symbol value whose [[Description]] value is + descString. +features: [Symbol] +---*/ + +assert.notSameValue(Symbol(''), Symbol(''), 'empty string'); +assert.notSameValue(Symbol(), Symbol(), 'undefined'); +assert.notSameValue(Symbol(null), Symbol(null), 'null value'); +assert.notSameValue(Symbol('x'), Symbol('x'), 'string "x"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/unscopables/browser.js b/js/src/tests/test262/built-ins/Symbol/unscopables/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/unscopables/browser.js diff --git a/js/src/tests/test262/built-ins/Symbol/unscopables/cross-realm.js b/js/src/tests/test262/built-ins/Symbol/unscopables/cross-realm.js new file mode 100644 index 0000000000..1d17a7d0e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/unscopables/cross-realm.js @@ -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-symbol.unscopables +description: Value shared by all realms +info: | + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [cross-realm, Symbol.unscopables] +---*/ + +var OSymbol = $262.createRealm().global.Symbol; + +assert.sameValue(Symbol.unscopables, OSymbol.unscopables); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/unscopables/prop-desc.js b/js/src/tests/test262/built-ins/Symbol/unscopables/prop-desc.js new file mode 100644 index 0000000000..50fc65e7ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/unscopables/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.14 +description: > + `Symbol.unscopables` property descriptor +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.unscopables] +---*/ + +assert.sameValue(typeof Symbol.unscopables, 'symbol'); +verifyNotEnumerable(Symbol, 'unscopables'); +verifyNotWritable(Symbol, 'unscopables'); +verifyNotConfigurable(Symbol, 'unscopables'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Symbol/unscopables/shell.js b/js/src/tests/test262/built-ins/Symbol/unscopables/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/unscopables/shell.js |