diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag')
22 files changed, 534 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/browser.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/browser.js diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js new file mode 100644 index 0000000000..df8573d85d --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: The getter method does not throw with a detached buffer +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + ... + 4. Let name be the value of O's [[TypedArrayName]] internal slot. + 5. Assert: name is a String value. + 6. Return name. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample[Symbol.toStringTag], TA.name); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js new file mode 100644 index 0000000000..d22df1a051 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js @@ -0,0 +1,22 @@ +// 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-get-%typedarray%.prototype-@@tostringtag +description: > + Return undefined if this value does not have a [[TypedArrayName]] internal slot +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(TypedArrayPrototype[Symbol.toStringTag], undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js new file mode 100644 index 0000000000..fa28fde06b --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: If this value is not Object, return undefined. +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + 2. If Type(O) is not Object, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js new file mode 100644 index 0000000000..246f30b499 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + get %TypedArray%.prototype [ @@toStringTag ].length is 0. +info: | + get %TypedArray%.prototype [ @@toStringTag ] + + 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, testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag); + +assert.sameValue(desc.get.length, 0); + +verifyNotEnumerable(desc.get, "length"); +verifyNotWritable(desc.get, "length"); +verifyConfigurable(desc.get, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js new file mode 100644 index 0000000000..3b77f82c2b --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]". +info: | + get %TypedArray%.prototype [ @@toStringTag ] + + 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, testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag); + +assert.sameValue(desc.get.name, "get [Symbol.toStringTag]"); + +verifyNotEnumerable(desc.get, "name"); +verifyNotWritable(desc.get, "name"); +verifyConfigurable(desc.get, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js new file mode 100644 index 0000000000..070228754a --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + "@@toStringTag" property of TypedArrayPrototype +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + %TypedArray%.prototype[@@toStringTag] is an accessor property whose set + accessor function is undefined. + ... + + This property has the attributes { [[Enumerable]]: false, [[Configurable]]: + true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); +verifyNotEnumerable(TypedArrayPrototype, Symbol.toStringTag); +verifyConfigurable(TypedArrayPrototype, Symbol.toStringTag); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js new file mode 100644 index 0000000000..34b025e7bd --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + Return value from the [[TypedArrayName]] internal slot +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + ... + 4. Let name be the value of O's [[TypedArrayName]] internal slot. + 5. Assert: name is a String value. + 6. Return name. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ta = new TA(); + assert.sameValue(ta[Symbol.toStringTag], TA.name, "property value"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/shell.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/shell.js new file mode 100644 index 0000000000..90ee9c114d --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/shell.js @@ -0,0 +1,42 @@ +// GENERATED, DO NOT EDIT +// file: testBigIntTypedArray.js +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Collection of functions used to assert the correctness of BigInt TypedArray objects. +defines: + - TypedArray + - testWithBigIntTypedArrayConstructors +---*/ + +/** + * The %TypedArray% intrinsic constructor function. + */ +var TypedArray = Object.getPrototypeOf(Int8Array); + +/** + * Calls the provided function for every typed array constructor. + * + * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. + * @param {Array} selected - An optional Array with filtered typed arrays + */ +function testWithBigIntTypedArrayConstructors(f, selected) { + /** + * Array containing every BigInt typed array constructor. + */ + var constructors = selected || [ + BigInt64Array, + BigUint64Array + ]; + + for (var i = 0; i < constructors.length; ++i) { + var constructor = constructors[i]; + try { + f(constructor); + } catch (e) { + e.message += " (Testing with " + constructor.name + ".)"; + throw e; + } + } +} diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js new file mode 100644 index 0000000000..59ed5bc04d --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.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-get-%typedarray%.prototype-@@tostringtag +description: > + Return undefined when `this` does not have a [[TypedArrayName]] internal slot +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, DataView, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter.call({}), undefined); +assert.sameValue(getter.call([]), undefined); +assert.sameValue(getter.call(new ArrayBuffer(8)), undefined); + +var ab = new ArrayBuffer(8); +var dv = new DataView(ab, 0, 1); +assert.sameValue(getter.call(dv), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js new file mode 100644 index 0000000000..9a040f049f --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: Return undefined when `this` is not Object +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + 2. If Type(O) is not Object, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter.call(undefined), undefined, "this is undefined"); +assert.sameValue(getter.call(42), undefined, "this is 42"); +assert.sameValue(getter.call("foo"), undefined, "this is a string"); +assert.sameValue(getter.call(true), undefined, "this is true"); +assert.sameValue(getter.call(false), undefined, "this is false"); +assert.sameValue(getter.call(Symbol("s")), undefined, "this is a Symbol"); +assert.sameValue(getter.call(null), undefined, "this is null"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/browser.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/browser.js diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/detached-buffer.js new file mode 100644 index 0000000000..2644bfebd4 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/detached-buffer.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: The getter method does not throw with a detached buffer +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + ... + 4. Let name be the value of O's [[TypedArrayName]] internal slot. + 5. Assert: name is a String value. + 6. Return name. +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [Symbol.toStringTag, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample[Symbol.toStringTag], TA.name); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js new file mode 100644 index 0000000000..227ff392a1 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js @@ -0,0 +1,22 @@ +// 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-get-%typedarray%.prototype-@@tostringtag +description: > + Return undefined if this value does not have a [[TypedArrayName]] internal slot +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, return undefined. + ... +includes: [testTypedArray.js] +features: [Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(TypedArrayPrototype[Symbol.toStringTag], undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js new file mode 100644 index 0000000000..f05d7656d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: If this value is not Object, return undefined. +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + 2. If Type(O) is not Object, return undefined. + ... +includes: [testTypedArray.js] +features: [Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js new file mode 100644 index 0000000000..d47c20684b --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + get %TypedArray%.prototype [ @@toStringTag ].length is 0. +info: | + get %TypedArray%.prototype [ @@toStringTag ] + + 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, testTypedArray.js] +features: [Symbol.toStringTag] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag); + +assert.sameValue(desc.get.length, 0); + +verifyNotEnumerable(desc.get, "length"); +verifyNotWritable(desc.get, "length"); +verifyConfigurable(desc.get, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js new file mode 100644 index 0000000000..6de76bd40f --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]". +info: | + get %TypedArray%.prototype [ @@toStringTag ] + + 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, testTypedArray.js] +features: [Symbol.toStringTag] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag); + +assert.sameValue(desc.get.name, "get [Symbol.toStringTag]"); + +verifyNotEnumerable(desc.get, "name"); +verifyNotWritable(desc.get, "name"); +verifyConfigurable(desc.get, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js new file mode 100644 index 0000000000..7fda276f58 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + "@@toStringTag" property of TypedArrayPrototype +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + %TypedArray%.prototype[@@toStringTag] is an accessor property whose set + accessor function is undefined. + ... + + This property has the attributes { [[Enumerable]]: false, [[Configurable]]: + true }. +includes: [propertyHelper.js, testTypedArray.js] +features: [Symbol.toStringTag] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); +verifyNotEnumerable(TypedArrayPrototype, Symbol.toStringTag); +verifyConfigurable(TypedArrayPrototype, Symbol.toStringTag); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/return-typedarrayname.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/return-typedarrayname.js new file mode 100644 index 0000000000..4cc973019c --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/return-typedarrayname.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + Return value from the [[TypedArrayName]] internal slot +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + ... + 4. Let name be the value of O's [[TypedArrayName]] internal slot. + 5. Assert: name is a String value. + 6. Return name. +includes: [testTypedArray.js] +features: [Symbol.toStringTag, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var ta = new TA(); + assert.sameValue(ta[Symbol.toStringTag], TA.name, "property value"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/shell.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/shell.js diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/this-has-no-typedarrayname-internal.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/this-has-no-typedarrayname-internal.js new file mode 100644 index 0000000000..06450f6030 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/this-has-no-typedarrayname-internal.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-get-%typedarray%.prototype-@@tostringtag +description: > + Return undefined when `this` does not have a [[TypedArrayName]] internal slot +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, return undefined. + ... +includes: [testTypedArray.js] +features: [Symbol.toStringTag, DataView, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter.call({}), undefined); +assert.sameValue(getter.call([]), undefined); +assert.sameValue(getter.call(new ArrayBuffer(8)), undefined); + +var ab = new ArrayBuffer(8); +var dv = new DataView(ab, 0, 1); +assert.sameValue(getter.call(dv), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/this-is-not-object.js b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/this-is-not-object.js new file mode 100644 index 0000000000..460564f162 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/Symbol.toStringTag/this-is-not-object.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: Return undefined when `this` is not Object +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + 2. If Type(O) is not Object, return undefined. + ... +includes: [testTypedArray.js] +features: [Symbol, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter.call(undefined), undefined, "this is undefined"); +assert.sameValue(getter.call(42), undefined, "this is 42"); +assert.sameValue(getter.call("foo"), undefined, "this is a string"); +assert.sameValue(getter.call(true), undefined, "this is true"); +assert.sameValue(getter.call(false), undefined, "this is false"); +assert.sameValue(getter.call(Symbol("s")), undefined, "this is a Symbol"); +assert.sameValue(getter.call(null), undefined, "this is null"); + +reportCompare(0, 0); |