diff options
author | André Bargull <andre.bargull@gmail.com> | 2017-12-08 13:22:34 -0800 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2017-12-19 15:42:56 -0500 |
commit | 7f96cb10c174ab3d82210154d8e28b7392a4f26c (patch) | |
tree | 40dfe67dcb20b72be8254fdc080e401a55f7c549 /test/built-ins/TypedArrays/internals/HasProperty | |
parent | 6b8bd307d29dcf39f22bd067db513952e68dc811 (diff) | |
download | qtdeclarative-testsuites-7f96cb10c174ab3d82210154d8e28b7392a4f26c.tar.gz |
Add tests for accessing Infinity on detached typed arrays
Diffstat (limited to 'test/built-ins/TypedArrays/internals/HasProperty')
-rw-r--r-- | test/built-ins/TypedArrays/internals/HasProperty/infinity-with-detached-buffer.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/built-ins/TypedArrays/internals/HasProperty/infinity-with-detached-buffer.js b/test/built-ins/TypedArrays/internals/HasProperty/infinity-with-detached-buffer.js new file mode 100644 index 000000000..4d2001f03 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/infinity-with-detached-buffer.js @@ -0,0 +1,35 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +id: sec-integer-indexed-exotic-objects-hasproperty-p +info: > + "Infinity" is a canonical numeric string, test with access on detached buffer. +description: | + 9.4.5.2 [[HasProperty]]( P ) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let buffer be O.[[ViewedArrayBuffer]]. + ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... + + 7.1.16 CanonicalNumericIndexString ( argument ) + ... + 3. Let n be ! ToNumber(argument). + 4. If SameValue(! ToString(n), argument) is false, return undefined. + 5. Return n. + +flags: [noStrict] +includes: [testTypedArray.js, detachArrayBuffer.js] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(0); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + with (sample) Infinity; + }); +}); |