]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/iterator-functions.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / iterator-functions.js
CommitLineData
ed1e77d3
A
1function test(actual, expected) {
2 if (actual !== expected)
3 throw new Error('bad value: ' + actual);
4}
5
6test(Array.prototype[Symbol.iterator], Array.prototype.values);
7test(Map.prototype[Symbol.iterator], Map.prototype.entries);
8test(Set.prototype[Symbol.iterator], Set.prototype.values);
9
10function argumentsTests(values) {
11 test(function () {
12 return arguments[Symbol.iterator];
13 }(), values);
14
15 test(function (a, b, c) {
16 return arguments[Symbol.iterator];
17 }(), values);
18
19 test(function () {
20 'use strict';
21 return arguments[Symbol.iterator];
22 }(), values);
23
24 test(function (a, b, c) {
25 'use strict';
26 return arguments[Symbol.iterator];
27 }(), values);
28}
29
30argumentsTests(Array.prototype.values);
31var arrayValues = Array.prototype.values;
32Array.prototype.values = null;
33argumentsTests(arrayValues);