diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2018-02-15 18:03:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-15 18:03:39 -0500 |
commit | 7024f3fa11e7e5169c4d42fc8ee7de3e93f7de9d (patch) | |
tree | f2f7a2758bade35564399fad33fd8cb9fa98580f /test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js | |
parent | afa24856b4b9bc00315b3e47745187d33c471406 (diff) | |
parent | 857f1d429b939c6feef1951041b5c91c9f3a8b4a (diff) | |
download | qtdeclarative-testsuites-7024f3fa11e7e5169c4d42fc8ee7de3e93f7de9d.tar.gz |
Merge pull request #1413 from leobalter/cxielarko-bigint-ta-3
BigInt+TypedArray tests, splitted
Diffstat (limited to 'test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js')
-rw-r--r-- | test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..f98c9b5c0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// 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-%typedarray%.prototype.tolocalestring +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.28 %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: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var toLocaleString = TypedArray.prototype.toLocaleString; + +assert.throws(TypeError, function() { + toLocaleString.call({}); +}, "this is an Object"); + +assert.throws(TypeError, function() { + toLocaleString.call([]); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + toLocaleString.call(ab); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + toLocaleString.call(dv); +}, "this is a DataView instance"); |