diff --git a/test/built-ins/TypedArray/Symbol.species/prop-desc.js b/test/built-ins/TypedArray/Symbol.species/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..588a751405ccfcf6581dbe7dffec9f2307ff15f3 --- /dev/null +++ b/test/built-ins/TypedArray/Symbol.species/prop-desc.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. +/*--- +es6id: 22.2.2.4 +description: > + @@species property of TypedArray +info: > + 22.2.2.4 get %TypedArray% [ @@species ] + + %TypedArray%[@@species] is an accessor property whose set accessor function + is undefined. +features: [Symbol.species] +includes: [testTypedArray.js] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray, Symbol.species); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); diff --git a/test/built-ins/TypedArray/Symbol.species/result.js b/test/built-ins/TypedArray/Symbol.species/result.js new file mode 100644 index 0000000000000000000000000000000000000000..0e8aac7231c484640fa1716cb77f10d3a39bf633 --- /dev/null +++ b/test/built-ins/TypedArray/Symbol.species/result.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.2.4 +description: > + @@species property returns the `this` value +info: > + 22.2.2.4 get %TypedArray% [ @@species ] + + 1. Return the this value. +features: [Symbol.species] +includes: [testTypedArray.js] +---*/ + +var value = {}; +var getter = Object.getOwnPropertyDescriptor(TypedArray, Symbol.species).get; + +assert.sameValue(getter.call(value), value); diff --git a/test/built-ins/TypedArray/from/arylk-get-length-error.js b/test/built-ins/TypedArray/from/arylk-get-length-error.js new file mode 100644 index 0000000000000000000000000000000000000000..b851406ba7d9667ce6b645e62b70b55cf381a0c7 --- /dev/null +++ b/test/built-ins/TypedArray/from/arylk-get-length-error.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. +/*--- +es6id: 22.2.2.1.1 +description: Returns error produced by accessing array-like's length +info: > + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, thisArg ) + + ... + 12. Let len be ToLength(Get(arrayLike, "length")). + 13. ReturnIfAbrupt(len). + ... +includes: [testTypedArray.js] +---*/ + +var arrayLike = {}; + +Object.defineProperty(arrayLike, 'length', { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + TypedArray.from(arrayLike); +}); diff --git a/test/built-ins/TypedArray/from/arylk-to-length-error.js b/test/built-ins/TypedArray/from/arylk-to-length-error.js new file mode 100644 index 0000000000000000000000000000000000000000..b5907b2021ce5d5615138e961de4179590cd65a1 --- /dev/null +++ b/test/built-ins/TypedArray/from/arylk-to-length-error.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. +/*--- +es6id: 22.2.2.1.1 +description: Returns error produced by interpreting length property as a length +info: > + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, thisArg ) + + ... + 12. Let len be ToLength(Get(arrayLike, "length")). + 13. ReturnIfAbrupt(len). + ... +features: [Symbol.toPrimitive] +includes: [testTypedArray.js] +---*/ + +var arrayLike = { length: {} }; + +arrayLike.length[Symbol.toPrimitive] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + TypedArray.from(arrayLike); +}); diff --git a/test/built-ins/TypedArray/from/invoked-as-func.js b/test/built-ins/TypedArray/from/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..3574555e88ab2940081fe68a58003d937671bc80 --- /dev/null +++ b/test/built-ins/TypedArray/from/invoked-as-func.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. +/*--- +es6id: 22.2.2.1 +description: > + "from" cannot be invoked as a function +info: > + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + 1. Let C be the this value. + 2. If IsConstructor(C) is false, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +var from = TypedArray.from; + +assert.throws(TypeError, function() { + from([]); +}); diff --git a/test/built-ins/TypedArray/from/invoked-as-method.js b/test/built-ins/TypedArray/from/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..a40f5299b1399cc760e2ba70cc352ab6d34783d5 --- /dev/null +++ b/test/built-ins/TypedArray/from/invoked-as-method.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.2.1 +description: > + "from" cannot be invoked as a method of %TypedArray% +info: > + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 6. Return TypedArrayFrom(C, source, f, t). + + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, + thisArg ) + + ... + 8. If usingIterator is not undefined, then + ... + g. Let targetObj be AllocateTypedArray(C, len). + h. ReturnIfAbrupt(targetObj). + ... + + 22.2.1.2.1 Runtime Semantics: AllocateTypedArray (newTarget, length ) + + ... + 2. If SameValue(%TypedArray%, newTarget) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +assert.throws(TypeError, function() { + TypedArray.from([]); +}); diff --git a/test/built-ins/TypedArray/from/iter-access-error.js b/test/built-ins/TypedArray/from/iter-access-error.js new file mode 100644 index 0000000000000000000000000000000000000000..503ca0b1314c7ec3c7d1992bbf3ea6cee59670e4 --- /dev/null +++ b/test/built-ins/TypedArray/from/iter-access-error.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. +/*--- +es6id: 22.2.2.1.1 +description: Returns error produced by accessing @@iterator +info: > + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, + thisArg ) + + ... + 6. Let usingIterator be GetMethod(items, @@iterator). + 7. ReturnIfAbrupt(usingIterator). + ... +features: [Symbol.iterator] +includes: [testTypedArray.js] +---*/ + +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + TypedArray.from(iter); +}); diff --git a/test/built-ins/TypedArray/from/iter-invoke-error.js b/test/built-ins/TypedArray/from/iter-invoke-error.js new file mode 100644 index 0000000000000000000000000000000000000000..b846a377995d403e5ab6aafb9033b6691a87ceed --- /dev/null +++ b/test/built-ins/TypedArray/from/iter-invoke-error.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. +/*--- +es6id: 22.2.2.1.1 +description: Returns error produced by invoking @@iterator +info: > + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, + thisArg ) + + ... + 8. If usingIterator is not undefined, then + a. Let iterator be GetIterator(items, usingIterator). + b. ReturnIfAbrupt(iterator). + ... +features: [Symbol.iterator] +includes: [testTypedArray.js] +---*/ + +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + TypedArray.from(iter); +}); diff --git a/test/built-ins/TypedArray/from/iter-next-error.js b/test/built-ins/TypedArray/from/iter-next-error.js new file mode 100644 index 0000000000000000000000000000000000000000..014e26b9c86b9255b3bc37dbadcc6ede32b480db --- /dev/null +++ b/test/built-ins/TypedArray/from/iter-next-error.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.2.1.1 +description: Returns error produced by advancing the iterator +info: > + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, + thisArg ) + + ... + 8. If usingIterator is not undefined, then + ... + e. Repeat, while next is not false + i. Let next be IteratorStep(iterator). + ii. ReturnIfAbrupt(next). + ... +features: [Symbol.iterator] +includes: [testTypedArray.js] +---*/ + +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + TypedArray.from(iter); +}); diff --git a/test/built-ins/TypedArray/from/iter-next-value-error.js b/test/built-ins/TypedArray/from/iter-next-value-error.js new file mode 100644 index 0000000000000000000000000000000000000000..8081dc9830ca4895a890f8be025bd6ddd8960f33 --- /dev/null +++ b/test/built-ins/TypedArray/from/iter-next-value-error.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.2.1.1 +description: Returns error produced by accessing iterated value +info: > + 22.2.2.1.1 Runtime Semantics: TypedArrayFrom( constructor, items, mapfn, + thisArg ) + + ... + 8. If usingIterator is not undefined, then + ... + e. If next is not false, then + i. Let nextValue be IteratorValue(next). + ii. ReturnIfAbrupt(nextValue). +features: [Symbol.iterator] +includes: [testTypedArray.js] +---*/ + +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + var result = {}; + Object.defineProperty(result, 'value', { + get: function() { + throw new Test262Error(); + } + }); + + return result; + } + }; +}; + +assert.throws(Test262Error, function() { + TypedArray.from(iter); +}); diff --git a/test/built-ins/TypedArray/from/prop-desc.js b/test/built-ins/TypedArray/from/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..82ab624fe23e25b9172c6b8e349b0c27271a11cb --- /dev/null +++ b/test/built-ins/TypedArray/from/prop-desc.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. +/*--- +es6id: 22.2.2.1 +description: > + "from" property of TypedArray +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +verifyNotEnumerable(TypedArray, 'from'); +verifyWritable(TypedArray, 'from'); +verifyConfigurable(TypedArray, 'from'); diff --git a/test/built-ins/TypedArray/invoked-as-ctor-with-arguments.js b/test/built-ins/TypedArray/invoked-as-ctor-with-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..6bc266f56bfaf85482b704417ebf7845459384d5 --- /dev/null +++ b/test/built-ins/TypedArray/invoked-as-ctor-with-arguments.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. +/*--- +es7id: pending +description: TypedArray(length) cannot be direclty invoked as a constructor +info: > + 22.2.1.1 %TypedArray%()# + + 1. If NewTarget is undefined, throw a TypeError exception. + 2. Let here be the active function object. + 3. If SameValue(NewTarget, here) is true, throw a TypeError exception. + ... + + Note: there's a breaking change from ES2015's 22.2.1.2 step 7 where calling + the %TypedArray% constructor with a floating number as the argument throws a + RangeError exception before checking `SameValue(NewTarget, here)`. +includes: [testTypedArray.js] +---*/ + +assert.throws(TypeError, function() { + new TypedArray(1); +}); + +assert.throws(TypeError, function() { + new TypedArray({}); +}); + +assert.throws(TypeError, function() { + new TypedArray(1.1); +}); diff --git a/test/built-ins/TypedArray/invoked-as-ctor.js b/test/built-ins/TypedArray/invoked-as-ctor.js new file mode 100644 index 0000000000000000000000000000000000000000..668a963404d75250b6bc4b2f62b2c2ea031f9445 --- /dev/null +++ b/test/built-ins/TypedArray/invoked-as-ctor.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. +/*--- +es6id: 22.2.1.2.1 +description: TypedArray cannot be invoked as a constructor +info: > + 22.2.1.2.1 Runtime Semantics: AllocateTypedArray (newTarget, length ) + + ... + 2. If SameValue(%TypedArray%, newTarget) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +assert.throws(TypeError, function() { + new TypedArray(); +}); diff --git a/test/built-ins/TypedArray/invoked-as-func.js b/test/built-ins/TypedArray/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..a7a5d990f2c7f1f6eaa4c9f1b58c30a1cbd6c56c --- /dev/null +++ b/test/built-ins/TypedArray/invoked-as-func.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. +/*--- +es6id: 22.2.1.1 +description: If NewTarget is undefined, throw a TypeError exception. +info: > + 22.2.1.1 %TypedArray% ( ) + + 1. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +assert.throws(TypeError, function() { + TypedArray(); +}); diff --git a/test/built-ins/TypedArray/length.js b/test/built-ins/TypedArray/length.js new file mode 100644 index 0000000000000000000000000000000000000000..b198205b63f8f6c094f2114cf4fc91c06961ad71 --- /dev/null +++ b/test/built-ins/TypedArray/length.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. +/*--- +es6id: 22.2.2 +description: > + TypedArray has a "length" property whose value is 3. +info: > + 22.2.2 Properties of the %TypedArray% Intrinsic Object + + Besides a length property whose value is 3 and a name property whose value is + "TypedArray", %TypedArray% has the following properties: + ... + + ES6 section 17: 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] +---*/ + +assert.sameValue(TypedArray.length, 3); + +verifyNotEnumerable(TypedArray, 'length'); +verifyNotWritable(TypedArray, 'length'); +verifyConfigurable(TypedArray, 'length'); diff --git a/test/built-ins/TypedArray/name.js b/test/built-ins/TypedArray/name.js new file mode 100644 index 0000000000000000000000000000000000000000..9ad6731e7d71ba73169210380d5c625f6c5c8526 --- /dev/null +++ b/test/built-ins/TypedArray/name.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. +/*--- +es6id: 22.2.2 +description: > + TypedArray has a 'name' property whose value is "TypedArray". +info: > + 22.2.2 Properties of the %TypedArray% Intrinsic Object + + Besides a length property whose value is 3 and a name property whose value is + "TypedArray", %TypedArray% has the following properties: + ... + + 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 }. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +assert.sameValue(TypedArray.name, 'TypedArray'); + +verifyNotEnumerable(TypedArray, 'name'); +verifyNotWritable(TypedArray, 'name'); +verifyConfigurable(TypedArray, 'name'); diff --git a/test/built-ins/TypedArray/of/invoked-as-func.js b/test/built-ins/TypedArray/of/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..271b3828c112742e8b5c5f48063dec23f1d1ca7d --- /dev/null +++ b/test/built-ins/TypedArray/of/invoked-as-func.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. +/*--- +es6id: 22.2.2.2 +description: > + "of" cannot be invoked as a function +info: > + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 3. Let C be the this value. + 4. If IsConstructor(C) is false, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +var of = TypedArray.of; + +assert.throws(TypeError, function() { + of(); +}); diff --git a/test/built-ins/TypedArray/of/invoked-as-method.js b/test/built-ins/TypedArray/of/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..cb0f30b634ead1a813bfd2df2da3e1791efe18d7 --- /dev/null +++ b/test/built-ins/TypedArray/of/invoked-as-method.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. +/*--- +es6id: 22.2.2.2 +description: > + "of" cannot be invoked as a method of %TypedArray% +info: > + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 5. Let newObj be AllocateTypedArray(C, len). + 6. ReturnIfAbrupt(newObj). + ... + + 22.2.1.2.1 Runtime Semantics: AllocateTypedArray (newTarget, length ) + + ... + 2. If SameValue(%TypedArray%, newTarget) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +assert.throws(TypeError, function() { + TypedArray.of(); +}); diff --git a/test/built-ins/TypedArray/of/prop-desc.js b/test/built-ins/TypedArray/of/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..be52c5501e95404726858decf625d0dbc15f0c35 --- /dev/null +++ b/test/built-ins/TypedArray/of/prop-desc.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. +/*--- +es6id: 22.2.2.2 +description: > + "of" property of TypedArray +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +verifyNotEnumerable(TypedArray, 'of'); +verifyWritable(TypedArray, 'of'); +verifyConfigurable(TypedArray, 'of'); diff --git a/test/built-ins/TypedArray/prototype.js b/test/built-ins/TypedArray/prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..fceb4877795f3f23ad698691c6aa76893bf4e80b --- /dev/null +++ b/test/built-ins/TypedArray/prototype.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. +/*--- +es6id: 22.2.2.3 +description: > + "prototype" property of TypedArray +info: > + 22.2.2.3 %TypedArray%.prototype + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +verifyNotEnumerable(TypedArray, 'prototype'); +verifyNotWritable(TypedArray, 'prototype'); +verifyNotConfigurable(TypedArray, 'prototype'); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js new file mode 100644 index 0000000000000000000000000000000000000000..2f8f3aa361cc2e06b524cf159e7c77584e1fdb4d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.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. +/*--- +es6id: 22.2.3.31 +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. + ... +features: [Symbol.toStringTag] +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(TypedArrayPrototype[Symbol.toStringTag], undefined); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..5fd80bb9996062593de3ceb998f3dbb66ae510eb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.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. +/*--- +es6id: 22.2.3.31 +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. + ... +features: [Symbol.toStringTag] +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter(), undefined); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..b1555d5d23830b5033c0ed4781c277345c9b4517 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.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. +/*--- +es6id: 22.2.3.31 +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); diff --git a/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js new file mode 100644 index 0000000000000000000000000000000000000000..fd54b612be41f39860cd639b9cafdd336c11ec2e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/buffer/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. +/*--- +es6id: 22.2.3.1 +description: > + Requires this value to have a [[ViewedArrayBuffer]] internal slot +info: > + 22.2.3.1 get %TypedArray%.prototype.buffer + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[ViewedArrayBuffer]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.throws(TypeError, function() { + TypedArrayPrototype.buffer; +}); diff --git a/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js b/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..c562e5f64dedc88937d1f515a2d09937c4412d4e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.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. +/*--- +es6id: 22.2.3.1 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.1 get %TypedArray%.prototype.buffer + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[ViewedArrayBuffer]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, 'buffer' +).get; + +assert.throws(TypeError, function() { + getter(); +}); diff --git a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..a413419495062a460d8f167443b18be38331f1dd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/buffer/prop-desc.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. +/*--- +es6id: 22.2.3.1 +description: > + "buffer" property of TypedArrayPrototype +info: > + %TypedArray%.prototype.buffer is an accessor property whose set accessor + function is undefined. +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor(TypedArrayPrototype, 'buffer'); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); diff --git a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js new file mode 100644 index 0000000000000000000000000000000000000000..1dd23764866e28a64ddb7ee56c3fb4e3374bde50 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteLength/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. +/*--- +es6id: 22.2.3.2 +description: > + Requires this value to have a [[ViewedArrayBuffer]] internal slot +info: > + 22.2.3.2 get %TypedArray%.prototype.byteLength + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[ViewedArrayBuffer]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.throws(TypeError, function() { + TypedArrayPrototype.byteLength; +}); diff --git a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..2bc60130ac4c6020a4e15848e0dce56a5f4bb773 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.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. +/*--- +es6id: 22.2.3.2 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.2 get %TypedArray%.prototype.byteLength + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[ViewedArrayBuffer]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, 'byteLength' +).get; + +assert.throws(TypeError, function() { + getter(); +}); diff --git a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..8ceec382530b9bf5b80d451a863e43832ddf8440 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.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. +/*--- +es6id: 22.2.3.2 +description: > + "byteLength" property of TypedArrayPrototype +info: > + %TypedArray%.prototype.byteLength is an accessor property whose set accessor + function is undefined. +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor(TypedArrayPrototype, 'byteLength'); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js new file mode 100644 index 0000000000000000000000000000000000000000..2c9e86b11adf9a946953f913731240168bed3d37 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteOffset/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. +/*--- +es6id: 22.2.3.3 +description: > + Requires this value to have a [[ViewedArrayBuffer]] internal slot +info: > + 22.2.3.3 get %TypedArray%.prototype.byteOffset + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[ViewedArrayBuffer]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.throws(TypeError, function() { + TypedArrayPrototype.byteOffset; +}); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..e3563a7b0099e5c5fc65a271144a0925209c8c8f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.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. +/*--- +es6id: 22.2.3.3 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.3 get %TypedArray%.prototype.byteOffset + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[ViewedArrayBuffer]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, 'byteOffset' +).get; + +assert.throws(TypeError, function() { + getter(); +}); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..7b180db704eb011873a6c4d62a0df1b6993bab12 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.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. +/*--- +es6id: 22.2.3.3 +description: > + "byteOffset" property of TypedArrayPrototype +info: > + %TypedArray%.prototype.byteOffset is an accessor property whose set accessor + function is undefined. +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor(TypedArrayPrototype, 'byteOffset'); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..65cab4df09f14008fd887ffe035db24820c7a020 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.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. +/*--- +es6id: 22.2.3.5 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var copyWithin = TypedArray.prototype.copyWithin; + +assert.sameValue(typeof copyWithin, 'function'); + +assert.throws(TypeError, function() { + copyWithin(); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..8b6672549c66cc3884891f5d23f599408bdb4aee --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.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. +/*--- +es6id: 22.2.3.5 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.copyWithin, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.copyWithin(); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..8c4a2c6c88ef4e397ace6dc339bb0c40d5d0c8ba --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.5 +description: > + "copyWithin" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'copyWithin'); +verifyWritable(TypedArrayPrototype, 'copyWithin'); +verifyConfigurable(TypedArrayPrototype, 'copyWithin'); diff --git a/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js b/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..9242e0f4298f489ece8e531bcd0c9e456ef6e33c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/entries/invoked-as-func.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. +/*--- +es6id: 22.2.3.6 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.6 %TypedArray%.prototype.entries ( ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var entries = TypedArray.prototype.entries; + +assert.sameValue(typeof entries, 'function'); + +assert.throws(TypeError, function() { + entries(); +}); diff --git a/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js b/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..02a760463f8024d585379f7dfd6005fac66a7e3a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/entries/invoked-as-method.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. +/*--- +es6id: 22.2.3.6 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.6 %TypedArray%.prototype.entries ( ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.entries, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.entries(); +}); diff --git a/test/built-ins/TypedArray/prototype/entries/prop-desc.js b/test/built-ins/TypedArray/prototype/entries/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..cc475dcf0079c733397c98897b94a593cd89fbf6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/entries/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.6 +description: > + "entries" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'entries'); +verifyWritable(TypedArrayPrototype, 'entries'); +verifyConfigurable(TypedArrayPrototype, 'entries'); diff --git a/test/built-ins/TypedArray/prototype/every/invoked-as-func.js b/test/built-ins/TypedArray/prototype/every/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7f559c3d4218d792fd0bdc117994b4c3aa751b14 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/invoked-as-func.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. +/*--- +es6id: 22.2.3.7 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var every = TypedArray.prototype.every; + +assert.sameValue(typeof every, 'function'); + +assert.throws(TypeError, function() { + every(); +}); diff --git a/test/built-ins/TypedArray/prototype/every/invoked-as-method.js b/test/built-ins/TypedArray/prototype/every/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..56cd96f3f169f30c3dea254b8f54d9a9c8a321b1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/invoked-as-method.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. +/*--- +es6id: 22.2.3.7 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.every, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.every(); +}); diff --git a/test/built-ins/TypedArray/prototype/every/prop-desc.js b/test/built-ins/TypedArray/prototype/every/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..1e413925edd7a60f6a19af32df53b4f21b7642ee --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.7 +description: > + "every" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'every'); +verifyWritable(TypedArrayPrototype, 'every'); +verifyConfigurable(TypedArrayPrototype, 'every'); diff --git a/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js b/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..d5f439a1df5bc9cbd0afb5a2441e1115e8302205 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/invoked-as-func.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. +/*--- +es6id: 22.2.3.8 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var fill = TypedArray.prototype.fill; + +assert.sameValue(typeof fill, 'function'); + +assert.throws(TypeError, function() { + fill(); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js b/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..a13c438e115d9e56135d42954392c50b039c80bb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/invoked-as-method.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. +/*--- +es6id: 22.2.3.8 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.fill, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.fill(); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..1c230be5ac8271747569926e259f795a94213cb6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.8 +description: > + "fill" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'fill'); +verifyWritable(TypedArrayPrototype, 'fill'); +verifyConfigurable(TypedArrayPrototype, 'fill'); diff --git a/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js b/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..de884c8d704084b949bbb73c9ec07938a3b29c2d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/invoked-as-func.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. +/*--- +es6id: 22.2.3.9 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var filter = TypedArray.prototype.filter; + +assert.sameValue(typeof filter, 'function'); + +assert.throws(TypeError, function() { + filter(); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js b/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..2ca0c469f9df3c18277a160b203a8a6f0a7cdabf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/invoked-as-method.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. +/*--- +es6id: 22.2.3.9 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.filter, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.filter(); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..e813f4c8b9a2c828fe12dad8a3b3755b1e102294 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.9 +description: > + "filter" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'filter'); +verifyWritable(TypedArrayPrototype, 'filter'); +verifyConfigurable(TypedArrayPrototype, 'filter'); diff --git a/test/built-ins/TypedArray/prototype/find/invoked-as-func.js b/test/built-ins/TypedArray/prototype/find/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..356e3a2294753ed207189436ad024cdd56e10a94 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/invoked-as-func.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. +/*--- +es6id: 22.2.3.10 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var find = TypedArray.prototype.find; + +assert.sameValue(typeof find, 'function'); + +assert.throws(TypeError, function() { + find(); +}); diff --git a/test/built-ins/TypedArray/prototype/find/invoked-as-method.js b/test/built-ins/TypedArray/prototype/find/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..b31bb5cbce174a26a0bbf7d080ca68dc4c8d95e4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/invoked-as-method.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. +/*--- +es6id: 22.2.3.10 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.find, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.find(); +}); diff --git a/test/built-ins/TypedArray/prototype/find/prop-desc.js b/test/built-ins/TypedArray/prototype/find/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..1178a965adc5a63428c49307fd8f2815480ff199 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.10 +description: > + "find" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'find'); +verifyWritable(TypedArrayPrototype, 'find'); +verifyConfigurable(TypedArrayPrototype, 'find'); diff --git a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..a658addcc7d8bade1418f479a1d6eef6de50c92d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.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. +/*--- +es6id: 22.2.3.11 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var findIndex = TypedArray.prototype.findIndex; + +assert.sameValue(typeof findIndex, 'function'); + +assert.throws(TypeError, function() { + findIndex(); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..c9c4db94ed0de6890312ba2fd351c556addf2084 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.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. +/*--- +es6id: 22.2.3.11 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.findIndex, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.findIndex(); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..e9ed86235810719de7ff7af35229f5c42e982f38 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.11 +description: > + "findIndex" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'findIndex'); +verifyWritable(TypedArrayPrototype, 'findIndex'); +verifyConfigurable(TypedArrayPrototype, 'findIndex'); diff --git a/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js b/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..597904ac83d5592a60bd9bd6ee4ccc32715e8d05 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.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. +/*--- +es6id: 22.2.3.12 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var forEach = TypedArray.prototype.forEach; + +assert.sameValue(typeof forEach, 'function'); + +assert.throws(TypeError, function() { + forEach(); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js b/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..864f0724ac6d334fd90e34886aff48c61941565a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.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. +/*--- +es6id: 22.2.3.12 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.forEach, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.forEach(); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..3a4245f28526ac6838185a29bf0d01135fb23a36 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.12 +description: > + "forEach" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'forEach'); +verifyWritable(TypedArrayPrototype, 'forEach'); +verifyConfigurable(TypedArrayPrototype, 'forEach'); diff --git a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..906053d98893bc213703505e6e07472aa9895acd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.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. +/*--- +es6id: 22.2.3.13 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var indexOf = TypedArray.prototype.indexOf; + +assert.sameValue(typeof indexOf, 'function'); + +assert.throws(TypeError, function() { + indexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..08073d17dcfc8d3d75a26c71257202db75964552 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.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. +/*--- +es6id: 22.2.3.13 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.indexOf, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.indexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..5b3944df4939ea01c18109b49c9ee5829bf8dce4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.13 +description: > + "indexOf" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'indexOf'); +verifyWritable(TypedArrayPrototype, 'indexOf'); +verifyConfigurable(TypedArrayPrototype, 'indexOf'); diff --git a/test/built-ins/TypedArray/prototype/join/invoked-as-func.js b/test/built-ins/TypedArray/prototype/join/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..617c1c52736b99e4d1b3a425295782c5e79ea4b4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/invoked-as-func.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. +/*--- +es6id: 22.2.3.14 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.14 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var join = TypedArray.prototype.join; + +assert.sameValue(typeof join, 'function'); + +assert.throws(TypeError, function() { + join(); +}); diff --git a/test/built-ins/TypedArray/prototype/join/invoked-as-method.js b/test/built-ins/TypedArray/prototype/join/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..12bc15b5281333a35845681f0468a236a9d681ac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/invoked-as-method.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. +/*--- +es6id: 22.2.3.14 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.14 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.join, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.join(); +}); diff --git a/test/built-ins/TypedArray/prototype/join/prop-desc.js b/test/built-ins/TypedArray/prototype/join/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..74fc11282d5d801b74cc42112877ee11d41c1a63 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.14 +description: > + "join" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'join'); +verifyWritable(TypedArrayPrototype, 'join'); +verifyConfigurable(TypedArrayPrototype, 'join'); diff --git a/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js b/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..50e6d4129f3e406e822363593614556dd9f578c1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/invoked-as-func.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. +/*--- +es6id: 22.2.3.15 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.15 %TypedArray%.prototype.keys ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var keys = TypedArray.prototype.keys; + +assert.sameValue(typeof keys, 'function'); + +assert.throws(TypeError, function() { + keys(); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js b/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..2cab4fe744b40a633ac0d581355635a692ce390c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/invoked-as-method.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. +/*--- +es6id: 22.2.3.15 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.15 %TypedArray%.prototype.keys ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.keys, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.keys(); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..498ffe705aa47b503c18418c11638ecae990f9e0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.15 +description: > + "keys" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'keys'); +verifyWritable(TypedArrayPrototype, 'keys'); +verifyConfigurable(TypedArrayPrototype, 'keys'); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..04986c6adaa207d20648ee8725f3af1b4cefc350 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.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. +/*--- +es6id: 22.2.3.16 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var lastIndexOf = TypedArray.prototype.lastIndexOf; + +assert.sameValue(typeof lastIndexOf, 'function'); + +assert.throws(TypeError, function() { + lastIndexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..ca3dfcdb1a574c99601094e53e8fc495dfe6e780 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.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. +/*--- +es6id: 22.2.3.16 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.lastIndexOf, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.lastIndexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..62fb0184d6707f9c4371ca3857031530d82eac33 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.16 +description: > + "lastIndexOf" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'lastIndexOf'); +verifyWritable(TypedArrayPrototype, 'lastIndexOf'); +verifyConfigurable(TypedArrayPrototype, 'lastIndexOf'); diff --git a/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js new file mode 100644 index 0000000000000000000000000000000000000000..ff25f7f63b6779d24f357ccd7a83905175d790ee --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/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. +/*--- +es6id: 22.2.3.17 +description: > + Requires this value to have a [[ViewedArrayBuffer]] internal slot +info: > + 22.2.3.17 get %TypedArray%.prototype.length + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.throws(TypeError, function() { + TypedArrayPrototype.length; +}); diff --git a/test/built-ins/TypedArray/prototype/length/invoked-as-func.js b/test/built-ins/TypedArray/prototype/length/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..9a43198911e5725e43e1f59a980556d913bc9bc7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/invoked-as-func.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. +/*--- +es6id: 22.2.3.17 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.17 get %TypedArray%.prototype.length + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, 'length' +).get; + +assert.throws(TypeError, function() { + getter(); +}); diff --git a/test/built-ins/TypedArray/prototype/length/prop-desc.js b/test/built-ins/TypedArray/prototype/length/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..3f40eae8936c750cfce3177aa7801ea971929b60 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/prop-desc.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. +/*--- +es6id: 22.2.3.17 +description: > + "length" property of TypedArrayPrototype +info: > + %TypedArray%.prototype.length is an accessor property whose set accessor + function is undefined. +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor(TypedArrayPrototype, 'length'); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); diff --git a/test/built-ins/TypedArray/prototype/map/invoked-as-func.js b/test/built-ins/TypedArray/prototype/map/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7f79b30e472a9765fc347c1cfc26988c88e083b4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/invoked-as-func.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. +/*--- +es6id: 22.2.3.18 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var map = TypedArray.prototype.map; + +assert.sameValue(typeof map, 'function'); + +assert.throws(TypeError, function() { + map(); +}); diff --git a/test/built-ins/TypedArray/prototype/map/invoked-as-method.js b/test/built-ins/TypedArray/prototype/map/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..aaa28f537ded0a2a4db668a067ccf43e95d2e9fa --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/invoked-as-method.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. +/*--- +es6id: 22.2.3.18 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.map, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.map(); +}); diff --git a/test/built-ins/TypedArray/prototype/map/prop-desc.js b/test/built-ins/TypedArray/prototype/map/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..993923daa36904528706a0af718f6c80cd58f69a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.18 +description: > + "map" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'map'); +verifyWritable(TypedArrayPrototype, 'map'); +verifyConfigurable(TypedArrayPrototype, 'map'); diff --git a/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..b1162f9d2620b842814e28105f1827467fadc058 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.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. +/*--- +es6id: 22.2.3.19 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var reduce = TypedArray.prototype.reduce; + +assert.sameValue(typeof reduce, 'function'); + +assert.throws(TypeError, function() { + reduce(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..edb03023d5b0689c102663b479d897e0c31fc149 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.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. +/*--- +es6id: 22.2.3.19 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.reduce, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.reduce(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..a4001d0ebb9aa800e053d02910622e2ced50a1f6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.19 +description: > + "reduce" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'reduce'); +verifyWritable(TypedArrayPrototype, 'reduce'); +verifyConfigurable(TypedArrayPrototype, 'reduce'); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..6d359a03a7ba71686f9f993a1e845e91129d3ea9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.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. +/*--- +es6id: 22.2.3.20 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var reduceRight = TypedArray.prototype.reduceRight; + +assert.sameValue(typeof reduceRight, 'function'); + +assert.throws(TypeError, function() { + reduceRight(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..b24bde6d1ef3b0dfd1822b4af10680055b3fa8b2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.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. +/*--- +es6id: 22.2.3.20 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.reduceRight, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.reduceRight(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..0b61aed68452019568714459a10a28b93904bcb2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.20 +description: > + "reduceRight" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'reduceRight'); +verifyWritable(TypedArrayPrototype, 'reduceRight'); +verifyConfigurable(TypedArrayPrototype, 'reduceRight'); diff --git a/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f2aa678de8d808d1742ece1067a06a42e0d10d31 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.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. +/*--- +es6id: 22.2.3.21 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.21 %TypedArray%.prototype.reverse ( ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var reverse = TypedArray.prototype.reverse; + +assert.sameValue(typeof reverse, 'function'); + +assert.throws(TypeError, function() { + reverse(); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..b388fbb202db83a6919d982cb08baacbed051cf2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.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. +/*--- +es6id: 22.2.3.21 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.21 %TypedArray%.prototype.reverse ( ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.reverse, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.reverse(); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..414937f5fcae065fd9b44413ede961094becc1d7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.21 +description: > + "reverse" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'reverse'); +verifyWritable(TypedArrayPrototype, 'reverse'); +verifyConfigurable(TypedArrayPrototype, 'reverse'); diff --git a/test/built-ins/TypedArray/prototype/set/invoked-as-func.js b/test/built-ins/TypedArray/prototype/set/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..af8ba4534ac53c76c590b35d66ac4520db5a73ea --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/invoked-as-func.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. +/*--- +es6id: 22.2.3.22 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) + + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. +includes: [testTypedArray.js] +---*/ + +var set = TypedArray.prototype.set; + +assert.sameValue(typeof set, 'function'); + +assert.throws(TypeError, function() { + set(); +}); diff --git a/test/built-ins/TypedArray/prototype/set/invoked-as-method.js b/test/built-ins/TypedArray/prototype/set/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..5d4a8c0a660722cec3ca75f6614463394a4f5cbe --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/invoked-as-method.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. +/*--- +es6id: 22.2.3.22 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) + + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.set, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.set(); +}); diff --git a/test/built-ins/TypedArray/prototype/set/prop-desc.js b/test/built-ins/TypedArray/prototype/set/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..a6c5729f01ec1c558ef4f4ec2dae22f61051cfed --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.22 +description: > + "set" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'set'); +verifyWritable(TypedArrayPrototype, 'set'); +verifyConfigurable(TypedArrayPrototype, 'set'); diff --git a/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js b/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..bbdf67bd9a663134c67bbb69a1c632c8b7989ffb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/invoked-as-func.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. +/*--- +es6id: 22.2.3.23 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var slice = TypedArray.prototype.slice; + +assert.sameValue(typeof slice, 'function'); + +assert.throws(TypeError, function() { + slice(); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js b/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..abba815de263c03c46a49ea5cfb8235ce248d2ea --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/invoked-as-method.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. +/*--- +es6id: 22.2.3.23 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.slice, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.slice(); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..3961ea74c1b14f7eb3ddf55f6e6cbdd2733b3567 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.23 +description: > + "slice" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'slice'); +verifyWritable(TypedArrayPrototype, 'slice'); +verifyConfigurable(TypedArrayPrototype, 'slice'); diff --git a/test/built-ins/TypedArray/prototype/some/invoked-as-func.js b/test/built-ins/TypedArray/prototype/some/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..b597213d38c599c37ed056198a6e23035f4ffdfa --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/invoked-as-func.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. +/*--- +es6id: 22.2.3.24 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var some = TypedArray.prototype.some; + +assert.sameValue(typeof some, 'function'); + +assert.throws(TypeError, function() { + some(); +}); diff --git a/test/built-ins/TypedArray/prototype/some/invoked-as-method.js b/test/built-ins/TypedArray/prototype/some/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..99d39b76e8ded93a83e3e6d3a08f8e22d4f09d4a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/invoked-as-method.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. +/*--- +es6id: 22.2.3.24 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.some, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.some(); +}); diff --git a/test/built-ins/TypedArray/prototype/some/prop-desc.js b/test/built-ins/TypedArray/prototype/some/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..3f23f72812711da2e60e6d3cbc994d5246b20dc6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.24 +description: > + "some" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'some'); +verifyWritable(TypedArrayPrototype, 'some'); +verifyConfigurable(TypedArrayPrototype, 'some'); diff --git a/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js b/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..708e9349da525c1c67e1082f4503feb6ab8bb431 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.25 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) + + ... + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. + ... + + 1. Let obj be the this value as the argument. + 2. Let buffer be ValidateTypedArray(obj). + 3. ReturnIfAbrupt(buffer). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var sort = TypedArray.prototype.sort; + +assert.sameValue(typeof sort, 'function'); + +assert.throws(TypeError, function() { + sort(); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js b/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..ed84b118dcef5c502dbdd24ce2c2e670c72616ac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.25 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) + + ... + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. + ... + + 1. Let obj be the this value as the argument. + 2. Let buffer be ValidateTypedArray(obj). + 3. ReturnIfAbrupt(buffer). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.sort, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.sort(); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..17a2b0b8b1286008c1d74c8b6137e7eb0aed772f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.25 +description: > + "sort" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'sort'); +verifyWritable(TypedArrayPrototype, 'sort'); +verifyConfigurable(TypedArrayPrototype, 'sort'); diff --git a/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js b/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..80ce69fbf0e53d11e7903237bffc96d407b1240e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/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. +/*--- +es6id: 22.2.3.26 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var subarray = TypedArray.prototype.subarray; + +assert.sameValue(typeof subarray, 'function'); + +assert.throws(TypeError, function() { + subarray(); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js b/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..81f95b34655395a84f1f7dd6aeac90e87f1cfe37 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.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. +/*--- +es6id: 22.2.3.26 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.subarray, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.subarray(); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..15cf902850d7f5a108d4e3407b16a46f6ffe14a2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.26 +description: > + "subarray" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'subarray'); +verifyWritable(TypedArrayPrototype, 'subarray'); +verifyConfigurable(TypedArrayPrototype, 'subarray'); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ab6a51c3c27576992b8893774603b3da03ec6b66 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.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. +/*--- +es6id: 22.2.3.27 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + ... + + This function is not generic. ValidateTypedArray is applied to the this + value prior to evaluating the algorithm. If its result is an abrupt + completion that exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var toLocaleString = TypedArray.prototype.toLocaleString; + +assert.sameValue(typeof toLocaleString, 'function'); + +assert.throws(TypeError, function() { + toLocaleString(); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..99a74da07d416ce6d0ad72127c48dadcd4f67c6c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.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. +/*--- +es6id: 22.2.3.27 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + ... + + This function is not generic. ValidateTypedArray is applied to the this + value prior to evaluating the algorithm. If its result is an abrupt + completion that exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.toLocaleString, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.toLocaleString(); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..691b46f0a723a0e31adb8a131453f34622deeffb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.27 +description: > + "toLocaleString" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'toLocaleString'); +verifyWritable(TypedArrayPrototype, 'toLocaleString'); +verifyConfigurable(TypedArrayPrototype, 'toLocaleString'); diff --git a/test/built-ins/TypedArray/prototype/toString.js b/test/built-ins/TypedArray/prototype/toString.js new file mode 100644 index 0000000000000000000000000000000000000000..6d57cca3f7aa4f085dfd019a38ea9704736c9db7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toString.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. +/*--- +es6id: 22.2.3.28 +description: > + "toString" property of TypedArrayPrototype +info: > + 22.2.3.28 %TypedArray%.prototype.toString ( ) + + The initial value of the %TypedArray%.prototype.toString data property is the + same built-in function object as the Array.prototype.toString method defined + in 22.1.3.27. + + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(TypedArrayPrototype.toString, Array.prototype.toString); + +verifyNotEnumerable(TypedArrayPrototype, 'toString'); +verifyWritable(TypedArrayPrototype, 'toString'); +verifyConfigurable(TypedArrayPrototype, 'toString'); diff --git a/test/built-ins/TypedArray/prototype/values/invoked-as-func.js b/test/built-ins/TypedArray/prototype/values/invoked-as-func.js new file mode 100644 index 0000000000000000000000000000000000000000..efe1a7505fbf99072f55bf39b9af1885ab92d1e4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/invoked-as-func.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. +/*--- +es6id: 22.2.3.29 +description: Throws a TypeError exception when invoked as a function +info: > + 22.2.3.29 %TypedArray%.prototype.values ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var values = TypedArray.prototype.values; + +assert.sameValue(typeof values, 'function'); + +assert.throws(TypeError, function() { + values(); +}); diff --git a/test/built-ins/TypedArray/prototype/values/invoked-as-method.js b/test/built-ins/TypedArray/prototype/values/invoked-as-method.js new file mode 100644 index 0000000000000000000000000000000000000000..5d886158a1447a6c1baeda2cf0103dff01638961 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/invoked-as-method.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. +/*--- +es6id: 22.2.3.29 +description: Requires a [[TypedArrayName]] internal slot. +info: > + 22.2.3.29 %TypedArray%.prototype.values ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.values, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.values(); +}); diff --git a/test/built-ins/TypedArray/prototype/values/prop-desc.js b/test/built-ins/TypedArray/prototype/values/prop-desc.js new file mode 100644 index 0000000000000000000000000000000000000000..e367f124deb6f6803bd3a73bd07edbcb7b4a538d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.2.3.29 +description: > + "values" property of TypedArrayPrototype +info: > + ES6 section 17: Every other data property described in clauses 18 through + 26 and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'values'); +verifyWritable(TypedArrayPrototype, 'values'); +verifyConfigurable(TypedArrayPrototype, 'values');