Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / TypedArray / from / iter-next-value-error.js
bloba1674c417be0fbd451760363577bbd487147a7b2
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-%typedarray%.from
5 description: Returns error produced by accessing iterated value
6 info: |
7   22.2.2.1.1 Runtime Semantics: IterableToArrayLike( items )
9   2. If usingIterator is not undefined, then
10     ...
11     d. Repeat, while next is not false
12       ...
13       ii. If next is not false, then
14         1. Let nextValue be ? IteratorValue(next).
15   ...
16 includes: [testTypedArray.js]
17 features: [Symbol.iterator, TypedArray]
18 ---*/
20 var iter = {};
21 iter[Symbol.iterator] = function() {
22   return {
23     next: function() {
24       var result = {};
25       Object.defineProperty(result, 'value', {
26         get: function() {
27           throw new Test262Error();
28         }
29       });
31       return result;
32     }
33   };
36 assert.throws(Test262Error, function() {
37   TypedArray.from(iter);
38 });
40 reportCompare(0, 0);