]>
Commit | Line | Data |
---|---|---|
1 | function test(actual, expected) { | |
2 | if (actual !== expected) | |
3 | throw new Error('bad value: ' + actual); | |
4 | } | |
5 | ||
6 | test(Array.prototype[Symbol.iterator], Array.prototype.values); | |
7 | test(Map.prototype[Symbol.iterator], Map.prototype.entries); | |
8 | test(Set.prototype[Symbol.iterator], Set.prototype.values); | |
9 | ||
10 | function 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 | ||
30 | argumentsTests(Array.prototype.values); | |
31 | var arrayValues = Array.prototype.values; | |
32 | Array.prototype.values = null; | |
33 | argumentsTests(arrayValues); |