Chromium Code Reviews| Index: test/mjsunit/harmony/proxies-get.js |
| diff --git a/test/mjsunit/harmony/proxies-get.js b/test/mjsunit/harmony/proxies-get.js |
| index 812739066e435aec1ad63a4553ff8eec1b6b0047..ab5af2a4bd7c0823f72071772e19af0e75d4938f 100644 |
| --- a/test/mjsunit/harmony/proxies-get.js |
| +++ b/test/mjsunit/harmony/proxies-get.js |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -// Flags: --harmony-proxies |
| +// Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax |
| (function testBasicFunctionality() { |
| var target = { |
| @@ -93,3 +93,37 @@ |
| assertEquals("value", proxy.key2); |
| assertThrows(function(){ proxy.key3 }, TypeError); |
| })(); |
| + |
| +(function testGetPrivateSymbol() { |
| + var symbol = %CreatePrivateSymbol("secret"); |
| + var O = { [symbol]: "value" }; |
| + var proxy = new Proxy(O, { get(t, name) { assertUnreachable(); }}); |
| + assertEquals(undefined, proxy[symbol]); |
| + assertEquals(undefined, Reflect.get(proxy, symbol)); |
| + assertEquals("value", O[symbol]); |
| + assertEquals("value", Reflect.get(O, symbol)); |
| +})(); |
| + |
| +(function testGetInternalIterators() { |
| + var log = []; |
| + assertThrows(function() { |
|
neis
2015/12/03 12:01:24
Can you move the assertThrows down to the line tha
|
| + var array = [1,2,3,4,5] |
| + var origIt = array[Symbol.iterator](); |
| + var it = new Proxy(origIt, { |
| + get(t, name) { |
| + log.push(`[[Get]](iterator, ${String(name)})`); |
| + return Reflect.get(t, name); |
| + }, |
| + set(t, name, val) { |
| + log.push(`[[Set]](iterator, ${String(name)}, ${String(val)})`); |
| + return Reflect.set(t, name, val); |
| + } |
| + }); |
| + |
| + for (var v of it) log.push(v); |
| + }, TypeError); |
| + assertEquals([ |
| + "[[Get]](iterator, Symbol(Symbol.iterator))", |
| + "[[Get]](iterator, next)" |
| + ], log); |
| +})(); |