Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Flags: --harmony-proxies | |
| 6 | |
| 7 var target = { | |
| 8 "target_one": 1, | |
| 9 "property": "value" | |
| 10 }; | |
| 11 | |
| 12 var handler = { "handler": 1 }; | |
| 13 | |
| 14 var proxy = new Proxy(target, handler); | |
| 15 assertEquals("value", proxy.property); | |
| 16 assertEquals(undefined, proxy.nothing); | |
| 17 assertEquals(undefined, proxy.handler); | |
| 18 | |
| 19 handler.get = function() { return "value 2" }; | |
| 20 assertEquals("value 2", proxy.property); | |
| 21 assertEquals("value 2", proxy.nothing); | |
| 22 assertEquals("value 2", proxy.handler); | |
| 23 | |
|
Jakob Kummerow
2015/11/30 12:56:11
How about test cases for the code paths that throw
Camillo Bruni
2015/11/30 14:57:35
right, let's add some more detailed tests.
| |
| 24 var handler2 = new Proxy({"get": function() { return "value 3" }},{}); | |
| 25 var proxy2 = new Proxy(target, handler2); | |
| 26 assertEquals("value 3", proxy2.property); | |
| 27 assertEquals("value 3", proxy2.nothing); | |
| 28 assertEquals("value 3", proxy2.handler); | |
| OLD | NEW |