Commit 384ec6dc authored by neis's avatar neis Committed by Commit bot

[proxies] Adapt and reenable harmony/proxies-for.js test.

R=rossberg
BUG=v8:1543
LOG=n

Review URL: https://codereview.chromium.org/1491863002

Cr-Commit-Position: refs/heads/master@{#32579}
parent 8a70e9f9
......@@ -40,6 +40,8 @@ function TestWithProxies(test, x, y, z) {
// Iterate over a proxy.
Array.prototype.values = function() { return this[Symbol.iterator]() }
function TestForIn(properties, handler) {
TestWithProxies(TestForIn2, properties, handler)
}
......@@ -52,30 +54,17 @@ function TestForIn2(create, properties, handler) {
}
TestForIn(["0", "a"], {
enumerate: function() { return [0, "a"] }
enumerate: function() { return ["0", "a"].values() }
})
TestForIn(["null", "a"], {
enumerate: function() { return this.enumerate2() },
enumerate2: function() { return [null, "a"] }
})
TestForIn(["b", "d"], {
getPropertyNames: function() { return ["a", "b", "c", "d", "e"] },
getPropertyDescriptor: function(k) {
switch (k) {
case "a": return {enumerable: false, value: "3", configurable: true};
case "b": return {enumerable: true, get get() {}, configurable: true};
case "c": return {value: 4, configurable: true};
case "d": return {get enumerable() { return true }, configurable: true};
default: return undefined;
}
}
enumerate2: function() { return ["null", "a"].values() }
})
TestForIn(["b", "a", "0", "c"], new Proxy({}, {
get: function(pr, pk) {
return function() { return ["b", "a", 0, "c"] }
return function() { return ["b", "a", "0", "c"].values() }
}
}))
......@@ -103,31 +92,14 @@ function TestForInDerived2(create, properties, handler) {
}
TestForInDerived(["0", "a"], {
enumerate: function() { return [0, "a"] },
getPropertyDescriptor: function(k) {
return k == "0" || k == "a" ? {configurable: true} : undefined
}
enumerate: function() { return ["0", "a"].values() },
has: function(t, k) { return k == "0" || k == "a" }
})
TestForInDerived(["null", "a"], {
enumerate: function() { return this.enumerate2() },
enumerate2: function() { return [null, "a"] },
getPropertyDescriptor: function(k) {
return k == "null" || k == "a" ? {configurable: true} : undefined
}
})
TestForInDerived(["b", "d"], {
getPropertyNames: function() { return ["a", "b", "c", "d", "e"] },
getPropertyDescriptor: function(k) {
switch (k) {
case "a": return {enumerable: false, value: "3", configurable: true};
case "b": return {enumerable: true, get get() {}, configurable: true};
case "c": return {value: 4, configurable: true};
case "d": return {get enumerable() { return true }, configurable: true};
default: return undefined;
}
}
enumerate2: function() { return ["null", "a"].values() },
has: function(t, k) { return k == "null" || k == "a" }
})
......@@ -154,15 +126,6 @@ TestForInThrow({
enumerate2: function() { throw "myexn" }
})
TestForInThrow({
getPropertyNames: function() { throw "myexn" }
})
TestForInThrow({
getPropertyNames: function() { return ["a"] },
getPropertyDescriptor: function() { throw "myexn" }
})
TestForInThrow(new Proxy({}, {
get: function(pr, pk) {
return function() { throw "myexn" }
......@@ -170,7 +133,7 @@ TestForInThrow(new Proxy({}, {
}));
(function() {
var p = new Proxy({}, {enumerate:function() { return [0]; }});
var p = new Proxy({}, {enumerate:function() { return ["0"].values(); }});
var o = [0];
o.__proto__ = p;
var keys = [];
......
......@@ -90,7 +90,6 @@
'es6/regress/regress-cr493566': [SKIP],
'for-in-opt': [SKIP],
'harmony/proxies-example-membrane': [SKIP],
'harmony/proxies-for': [SKIP],
'harmony/proxies-hash': [SKIP],
'harmony/proxies-json': [SKIP],
'harmony/proxies': [SKIP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment