Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: test/mjsunit/harmony/proxies-enumerate.js

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing set super property test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/proxies.js ('k') | test/mjsunit/harmony/proxies-for.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-proxies 5 // Flags: --harmony-proxies
6 6 /*
Jakob Kummerow 2015/12/10 21:12:13 leftover?
7 var target = { 7 var target = {
8 "target_one": 1 8 "target_one": 1
9 }; 9 };
10 target.__proto__ = { 10 target.__proto__ = {
11 "target_two": 2 11 "target_two": 2
12 }; 12 };
13 var handler = { 13 var handler = {
14 enumerate: function(target) { 14 enumerate: function(target) {
15 function* keys() { 15 function* keys() {
16 yield "foo"; 16 yield "foo";
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 assertThrows("for (var k in proxy) {}", TypeError); 65 assertThrows("for (var k in proxy) {}", TypeError);
66 } 66 }
67 67
68 TestNonStringKey(1); 68 TestNonStringKey(1);
69 TestNonStringKey(3.14); 69 TestNonStringKey(3.14);
70 TestNonStringKey(Symbol("foo")); 70 TestNonStringKey(Symbol("foo"));
71 TestNonStringKey({bad: "value"}); 71 TestNonStringKey({bad: "value"});
72 TestNonStringKey(null); 72 TestNonStringKey(null);
73 TestNonStringKey(undefined); 73 TestNonStringKey(undefined);
74 TestNonStringKey(true); 74 TestNonStringKey(true);
75 */
76
77 (function testProtoProxyEnumerate() {
78 var keys = ['a', 'b', 'c', 'd'];
79 var handler = {
80 enumerate() { return keys[Symbol.iterator]() },
81 has(target, key) { return false }
82 };
83 var proxy = new Proxy({}, handler);
84 var seen_keys = [];
85 for (var i in proxy) {
86 seen_keys.push(i);
87 }
88 assertEquals([], seen_keys);
89
90 handler.has = function(target, key) { return true };
91 for (var i in proxy) {
92 seen_keys.push(i);
93 }
94 assertEquals(keys, seen_keys);
95
96 o = {__proto__:proxy};
97 handler.has = function(target, key) { return false };
98 seen_keys = [];
99 for (var i in o) {
100 seen_keys.push(i);
101 }
102 assertEquals([], seen_keys);
103
104 handler.has = function(target, key) { return true };
105 seen_keys = [];
106 for (var i in o) {
107 seen_keys.push(i);
108 }
109 assertEquals(keys, seen_keys);
110 })();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/proxies.js ('k') | test/mjsunit/harmony/proxies-for.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698