From 8f8b663ce7bc15c0f0d09521151fd566211ef8b2 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Mon, 1 Jun 2015 17:46:27 -0400 Subject: [PATCH 1/2] Add tests for TypedArray intrinsic --- .../TypedArray/Symbol.species/prop-desc.js | 19 ++++++++++ .../TypedArray/Symbol.species/result.js | 18 +++++++++ .../TypedArray/from/arylk-get-length-error.js | 26 +++++++++++++ .../TypedArray/from/arylk-to-length-error.js | 25 ++++++++++++ .../TypedArray/from/invoked-as-func.js | 20 ++++++++++ .../TypedArray/from/invoked-as-method.js | 33 ++++++++++++++++ .../TypedArray/from/iter-access-error.js | 27 +++++++++++++ .../TypedArray/from/iter-invoke-error.js | 26 +++++++++++++ .../TypedArray/from/iter-next-error.js | 32 ++++++++++++++++ .../TypedArray/from/iter-next-value-error.js | 38 +++++++++++++++++++ test/built-ins/TypedArray/from/prop-desc.js | 16 ++++++++ test/built-ins/TypedArray/invoked-as-ctor.js | 17 +++++++++ test/built-ins/TypedArray/invoked-as-func.js | 16 ++++++++ test/built-ins/TypedArray/length-invalid.js | 22 +++++++++++ test/built-ins/TypedArray/length.js | 24 ++++++++++++ test/built-ins/TypedArray/name.js | 24 ++++++++++++ .../TypedArray/of/invoked-as-func.js | 21 ++++++++++ .../TypedArray/of/invoked-as-method.js | 25 ++++++++++++ test/built-ins/TypedArray/of/prop-desc.js | 16 ++++++++ test/built-ins/TypedArray/prototype.js | 17 +++++++++ .../Symbol.toStringTag/invoked-as-accessor.js | 20 ++++++++++ .../Symbol.toStringTag/invoked-as-func.js | 21 ++++++++++ .../prototype/Symbol.toStringTag/prop-desc.js | 28 ++++++++++++++ .../prototype/buffer/invoked-as-accessor.js | 22 +++++++++++ .../prototype/buffer/invoked-as-func.js | 24 ++++++++++++ .../TypedArray/prototype/buffer/prop-desc.js | 17 +++++++++ .../byteLength/invoked-as-accessor.js | 22 +++++++++++ .../prototype/byteLength/invoked-as-func.js | 24 ++++++++++++ .../prototype/byteLength/prop-desc.js | 17 +++++++++ .../byteOffset/invoked-as-accessor.js | 22 +++++++++++ .../prototype/byteOffset/invoked-as-func.js | 24 ++++++++++++ .../prototype/byteOffset/prop-desc.js | 17 +++++++++ .../prototype/copyWithin/invoked-as-func.js | 28 ++++++++++++++ .../prototype/copyWithin/invoked-as-method.js | 28 ++++++++++++++ .../prototype/copyWithin/prop-desc.js | 18 +++++++++ .../prototype/entries/invoked-as-func.js | 31 +++++++++++++++ .../prototype/entries/invoked-as-method.js | 31 +++++++++++++++ .../TypedArray/prototype/entries/prop-desc.js | 18 +++++++++ .../prototype/every/invoked-as-func.js | 28 ++++++++++++++ .../prototype/every/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/every/prop-desc.js | 18 +++++++++ .../prototype/fill/invoked-as-func.js | 28 ++++++++++++++ .../prototype/fill/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/fill/prop-desc.js | 18 +++++++++ .../prototype/filter/invoked-as-func.js | 29 ++++++++++++++ .../prototype/filter/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/filter/prop-desc.js | 18 +++++++++ .../prototype/find/invoked-as-func.js | 28 ++++++++++++++ .../prototype/find/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/find/prop-desc.js | 18 +++++++++ .../prototype/findIndex/invoked-as-func.js | 28 ++++++++++++++ .../prototype/findIndex/invoked-as-method.js | 28 ++++++++++++++ .../prototype/findIndex/prop-desc.js | 18 +++++++++ .../prototype/forEach/invoked-as-func.js | 28 ++++++++++++++ .../prototype/forEach/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/forEach/prop-desc.js | 18 +++++++++ .../prototype/indexOf/invoked-as-func.js | 28 ++++++++++++++ .../prototype/indexOf/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/indexOf/prop-desc.js | 18 +++++++++ .../prototype/join/invoked-as-func.js | 28 ++++++++++++++ .../prototype/join/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/join/prop-desc.js | 18 +++++++++ .../prototype/keys/invoked-as-func.js | 29 ++++++++++++++ .../prototype/keys/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/keys/prop-desc.js | 18 +++++++++ .../prototype/lastIndexOf/invoked-as-func.js | 28 ++++++++++++++ .../lastIndexOf/invoked-as-method.js | 28 ++++++++++++++ .../prototype/lastIndexOf/prop-desc.js | 18 +++++++++ .../prototype/length/invoked-as-accessor.js | 22 +++++++++++ .../prototype/length/invoked-as-func.js | 22 +++++++++++ .../TypedArray/prototype/length/prop-desc.js | 17 +++++++++ .../prototype/map/invoked-as-func.js | 29 ++++++++++++++ .../prototype/map/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/map/prop-desc.js | 18 +++++++++ .../prototype/reduce/invoked-as-func.js | 29 ++++++++++++++ .../prototype/reduce/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/reduce/prop-desc.js | 18 +++++++++ .../prototype/reduceRight/invoked-as-func.js | 29 ++++++++++++++ .../reduceRight/invoked-as-method.js | 29 ++++++++++++++ .../prototype/reduceRight/prop-desc.js | 18 +++++++++ .../prototype/reverse/invoked-as-func.js | 29 ++++++++++++++ .../prototype/reverse/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/reverse/prop-desc.js | 18 +++++++++ .../prototype/set/invoked-as-func.js | 20 ++++++++++ .../prototype/set/invoked-as-method.js | 20 ++++++++++ .../TypedArray/prototype/set/prop-desc.js | 18 +++++++++ .../prototype/slice/invoked-as-func.js | 29 ++++++++++++++ .../prototype/slice/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/slice/prop-desc.js | 18 +++++++++ .../prototype/some/invoked-as-func.js | 28 ++++++++++++++ .../prototype/some/invoked-as-method.js | 28 ++++++++++++++ .../TypedArray/prototype/some/prop-desc.js | 18 +++++++++ .../prototype/sort/invoked-as-func.js | 34 +++++++++++++++++ .../prototype/sort/invoked-as-method.js | 34 +++++++++++++++++ .../TypedArray/prototype/sort/prop-desc.js | 18 +++++++++ .../prototype/subarray/invoked-as-func.js | 23 +++++++++++ .../prototype/subarray/invoked-as-method.js | 23 +++++++++++ .../prototype/subarray/prop-desc.js | 18 +++++++++ .../toLocaleString/invoked-as-func.js | 30 +++++++++++++++ .../toLocaleString/invoked-as-method.js | 30 +++++++++++++++ .../prototype/toLocaleString/prop-desc.js | 18 +++++++++ .../TypedArray/prototype/toString.js | 26 +++++++++++++ .../prototype/values/invoked-as-func.js | 29 ++++++++++++++ .../prototype/values/invoked-as-method.js | 29 ++++++++++++++ .../TypedArray/prototype/values/prop-desc.js | 18 +++++++++ 105 files changed, 2521 insertions(+) create mode 100644 test/built-ins/TypedArray/Symbol.species/prop-desc.js create mode 100644 test/built-ins/TypedArray/Symbol.species/result.js create mode 100644 test/built-ins/TypedArray/from/arylk-get-length-error.js create mode 100644 test/built-ins/TypedArray/from/arylk-to-length-error.js create mode 100644 test/built-ins/TypedArray/from/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/from/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/from/iter-access-error.js create mode 100644 test/built-ins/TypedArray/from/iter-invoke-error.js create mode 100644 test/built-ins/TypedArray/from/iter-next-error.js create mode 100644 test/built-ins/TypedArray/from/iter-next-value-error.js create mode 100644 test/built-ins/TypedArray/from/prop-desc.js create mode 100644 test/built-ins/TypedArray/invoked-as-ctor.js create mode 100644 test/built-ins/TypedArray/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/length-invalid.js create mode 100644 test/built-ins/TypedArray/length.js create mode 100644 test/built-ins/TypedArray/name.js create mode 100644 test/built-ins/TypedArray/of/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/of/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/of/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/buffer/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/byteLength/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/entries/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/entries/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/entries/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/every/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/every/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/every/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/fill/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/fill/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/fill/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/filter/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/filter/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/filter/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/find/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/find/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/find/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/join/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/join/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/join/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/keys/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/keys/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/keys/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/length/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/length/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/map/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/map/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/map/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/set/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/set/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/set/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/slice/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/slice/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/slice/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/some/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/some/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/some/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/sort/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/sort/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/sort/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/toString.js create mode 100644 test/built-ins/TypedArray/prototype/values/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/values/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/values/prop-desc.js 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 0000000000..588a751405 --- /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 0000000000..0e8aac7231 --- /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 0000000000..b851406ba7 --- /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 0000000000..b5907b2021 --- /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 0000000000..3574555e88 --- /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 0000000000..a40f5299b1 --- /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 0000000000..503ca0b131 --- /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 0000000000..b846a37799 --- /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 0000000000..014e26b9c8 --- /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 0000000000..8081dc9830 --- /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 0000000000..82ab624fe2 --- /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.js b/test/built-ins/TypedArray/invoked-as-ctor.js new file mode 100644 index 0000000000..668a963404 --- /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 0000000000..a7a5d990f2 --- /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-invalid.js b/test/built-ins/TypedArray/length-invalid.js new file mode 100644 index 0000000000..fc51e5465d --- /dev/null +++ b/test/built-ins/TypedArray/length-invalid.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.1.2 +description: TypedArray rejects non-integer arguments +info: > + 22.2.1.2 %TypedArray% ( length ) + + ... + 4. Let numberLength be ToNumber(length). + 5. Let elementLength be ToLength(numberLength). + 6. ReturnIfAbrupt(elementLength). + 7. If SameValueZero(numberLength, elementLength) is false, throw a RangeError + exception. + ... +features: [TypedArray] +includes: [testTypedArray.js] +---*/ + +assert.throws(RangeError, function() { + new TypedArray(1.1); +}); diff --git a/test/built-ins/TypedArray/length.js b/test/built-ins/TypedArray/length.js new file mode 100644 index 0000000000..b198205b63 --- /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 0000000000..9ad6731e7d --- /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 0000000000..271b3828c1 --- /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 0000000000..cb0f30b634 --- /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 0000000000..be52c5501e --- /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 0000000000..fceb487779 --- /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 0000000000..2f8f3aa361 --- /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 0000000000..5fd80bb999 --- /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 0000000000..b1555d5d23 --- /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 0000000000..fd54b612be --- /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 0000000000..c562e5f64d --- /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 0000000000..a413419495 --- /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 0000000000..1dd2376486 --- /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 0000000000..2bc60130ac --- /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 0000000000..8ceec38253 --- /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 0000000000..2c9e86b11a --- /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 0000000000..e3563a7b00 --- /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 0000000000..7b180db704 --- /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 0000000000..65cab4df09 --- /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 0000000000..8b6672549c --- /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 0000000000..8c4a2c6c88 --- /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 0000000000..9242e0f429 --- /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 0000000000..02a760463f --- /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 0000000000..cc475dcf00 --- /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 0000000000..7f559c3d42 --- /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 0000000000..56cd96f3f1 --- /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 0000000000..1e413925ed --- /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 0000000000..d5f439a1df --- /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 0000000000..a13c438e11 --- /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 0000000000..1c230be5ac --- /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 0000000000..de884c8d70 --- /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 0000000000..2ca0c469f9 --- /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 0000000000..e813f4c8b9 --- /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 0000000000..356e3a2294 --- /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 0000000000..b31bb5cbce --- /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 0000000000..1178a965ad --- /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 0000000000..a658addcc7 --- /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 0000000000..c9c4db94ed --- /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 0000000000..e9ed862358 --- /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 0000000000..597904ac83 --- /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 0000000000..864f0724ac --- /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 0000000000..3a4245f285 --- /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 0000000000..906053d988 --- /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 0000000000..08073d17dc --- /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 0000000000..5b3944df49 --- /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 0000000000..617c1c5273 --- /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 0000000000..12bc15b528 --- /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 0000000000..74fc11282d --- /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 0000000000..50e6d4129f --- /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 0000000000..2cab4fe744 --- /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 0000000000..498ffe705a --- /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 0000000000..04986c6ada --- /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 0000000000..ca3dfcdb1a --- /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 0000000000..62fb0184d6 --- /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 0000000000..ff25f7f63b --- /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 0000000000..9a43198911 --- /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 0000000000..3f40eae893 --- /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 0000000000..7f79b30e47 --- /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 0000000000..aaa28f537d --- /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 0000000000..993923daa3 --- /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 0000000000..b1162f9d26 --- /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 0000000000..edb03023d5 --- /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 0000000000..a4001d0ebb --- /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 0000000000..6d359a03a7 --- /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 0000000000..b24bde6d1e --- /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 0000000000..0b61aed684 --- /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 0000000000..f2aa678de8 --- /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 0000000000..b388fbb202 --- /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 0000000000..414937f5fc --- /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 0000000000..af8ba4534a --- /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 0000000000..5d4a8c0a66 --- /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 0000000000..a6c5729f01 --- /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 0000000000..bbdf67bd9a --- /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 0000000000..abba815de2 --- /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 0000000000..3961ea74c1 --- /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 0000000000..b597213d38 --- /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 0000000000..99d39b76e8 --- /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 0000000000..3f23f72812 --- /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 0000000000..708e9349da --- /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 0000000000..ed84b118dc --- /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 0000000000..17a2b0b8b1 --- /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 0000000000..80ce69fbf0 --- /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 0000000000..81f95b3465 --- /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 0000000000..15cf902850 --- /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 0000000000..ab6a51c3c2 --- /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 0000000000..99a74da07d --- /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 0000000000..691b46f0a7 --- /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 0000000000..6d57cca3f7 --- /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 0000000000..efe1a7505f --- /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 0000000000..5d886158a1 --- /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 0000000000..e367f124de --- /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'); From 1a64295a0bac867d69b0d1718ee0504bf738cbe8 Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Fri, 15 Jan 2016 15:51:54 -0500 Subject: [PATCH 2/2] Replace TypedArray constructor invalid length test for ES2016 specs Replace a ES2015 test where calling the TypedArray constructor with a floating number triggered a RangeError. Within the ES2016 specs, the same call will trigger a TypeError, as the result for `SameValue(NewTarget, here)` will be checked before. --- .../invoked-as-ctor-with-arguments.js | 30 +++++++++++++++++++ test/built-ins/TypedArray/length-invalid.js | 22 -------------- 2 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 test/built-ins/TypedArray/invoked-as-ctor-with-arguments.js delete mode 100644 test/built-ins/TypedArray/length-invalid.js 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 0000000000..6bc266f56b --- /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/length-invalid.js b/test/built-ins/TypedArray/length-invalid.js deleted file mode 100644 index fc51e5465d..0000000000 --- a/test/built-ins/TypedArray/length-invalid.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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 -description: TypedArray rejects non-integer arguments -info: > - 22.2.1.2 %TypedArray% ( length ) - - ... - 4. Let numberLength be ToNumber(length). - 5. Let elementLength be ToLength(numberLength). - 6. ReturnIfAbrupt(elementLength). - 7. If SameValueZero(numberLength, elementLength) is false, throw a RangeError - exception. - ... -features: [TypedArray] -includes: [testTypedArray.js] ----*/ - -assert.throws(RangeError, function() { - new TypedArray(1.1); -});