]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/values-unscopables.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / values-unscopables.js
1 function test(actual, expected) {
2 if (actual !== expected)
3 throw new Error('bad value: ' + actual);
4 }
5
6 (function () {
7 var array = [];
8 var values = 42;
9
10 with (array) {
11 test(values, 42);
12 }
13
14 array[Symbol.unscopables].values = false;
15
16 with (array) {
17 test(values, Array.prototype.values);
18 }
19 }());
20
21 (function () {
22 var map = new Map();
23 var values = 42;
24
25 with (map) {
26 test(values, Map.prototype.values);
27 }
28
29 map[Symbol.unscopables] = {
30 values: true
31 };
32
33 with (map) {
34 test(values, 42);
35 }
36 }());
37
38 (function () {
39 var set = new Set();
40 var values = 42;
41
42 with (set) {
43 test(values, Set.prototype.values);
44 }
45
46 set[Symbol.unscopables] = {
47 values: true
48 };
49
50 with (set) {
51 test(values, 42);
52 }
53 }());