diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/prototype/includes/return-abrupt-get-prop.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Array/prototype/includes/return-abrupt-get-prop.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/prototype/includes/return-abrupt-get-prop.js b/js/src/tests/test262/built-ins/Array/prototype/includes/return-abrupt-get-prop.js new file mode 100644 index 0000000000..14b1a49d47 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/includes/return-abrupt-get-prop.js @@ -0,0 +1,41 @@ +// 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-array.prototype.includes +description: Return abrupt getting index properties +info: | + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 7. Repeat, while k < len + a. Let elementK be the result of ? Get(O, ! ToString(k)). + ... +features: [Array.prototype.includes] +---*/ + +var stopped = 0; + +var obj = { + length: 3 +}; + +Object.defineProperty(obj, "1", { + get: function() { + throw new Test262Error(); + } +}); + +Object.defineProperty(obj, "2", { + get: function() { + stopped++; + } +}); + +assert.throws(Test262Error, function() { + [].includes.call(obj, 7); +}); + +assert.sameValue(stopped, 0, "It stops the loop after the abrupt completion"); + +reportCompare(0, 0); |