Chromium Code Reviews| Index: test/mjsunit/harmony/proxies-for.js |
| diff --git a/test/mjsunit/harmony/proxies-for.js b/test/mjsunit/harmony/proxies-for.js |
| index 0b7bcc2cd099def71a503069a3a4b4a4b58b32f3..e77e9ca0997e6b4236455289350c803c5cb98fe7 100644 |
| --- a/test/mjsunit/harmony/proxies-for.js |
| +++ b/test/mjsunit/harmony/proxies-for.js |
| @@ -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,30 +92,17 @@ 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" |
|
rossberg
2015/12/03 14:40:46
Nit: fit on one line
|
| } |
| }) |
| 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" |
|
rossberg
2015/12/03 14:40:46
Dito
|
| } |
| }) |
| @@ -154,15 +130,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 +137,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 = []; |