diff options
author | Leo Balter <leonardo.balter@gmail.com> | 2018-02-09 13:39:06 -0500 |
---|---|---|
committer | Leo Balter <leonardo.balter@gmail.com> | 2018-02-15 16:45:06 -0500 |
commit | c1bc43b1b10ec9d7c83ebee2af1837b78b784e52 (patch) | |
tree | 88aa3d799434cef567d2b1a8682b4fd6990c23d3 /test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js | |
parent | 5722ac494b89135cdcc406ec9ca3362920129346 (diff) | |
download | qtdeclarative-testsuites-c1bc43b1b10ec9d7c83ebee2af1837b78b784e52.tar.gz |
Restore original tests for TypedArrays and optimize files
- optimize file names
- BigInt folder for TAs.from and of
- copy tests preparing for bigint
- copy ta prototype methods for bigint
- Use an exclusive harness for bigint typedarrays
- add features
- use proper harness
- use preper harness
- Restore original tests for TypedArrays
- final fixes
- fix includes
Diffstat (limited to 'test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js')
-rw-r--r-- | test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js new file mode 100644 index 000000000..a967ec01c --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns abrupt from ToNumber(value) +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + var obj = { + valueOf: function() { + throw new Test262Error(); + } + }; + + assert.throws(Test262Error, function() { + sample["0"] = obj; + }, "ToNumber check with a valid index"); + + assert.throws(Test262Error, function() { + sample["1.1"] = obj; + }, "ToNumber runs before ToInteger(index)"); + + assert.throws(Test262Error, function() { + sample["-0"] = obj; + }, "ToNumber runs before -0 check"); + + assert.throws(Test262Error, function() { + sample["-1"] = obj; + }, "ToNumber runs before < 0 check"); + + assert.throws(Test262Error, function() { + sample["1"] = obj; + }, "ToNumber runs before index == length check"); + + assert.throws(Test262Error, function() { + sample["2"] = obj; + }, "ToNumber runs before index > length check"); +}); |