Chromium Code Reviews| Index: test/mjsunit/harmony/proxy-get.js |
| diff --git a/test/mjsunit/harmony/proxy-get.js b/test/mjsunit/harmony/proxy-get.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..72beadccec68357f22fa946cfe47fbb41a480382 |
| --- /dev/null |
| +++ b/test/mjsunit/harmony/proxy-get.js |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2015 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Flags: --harmony-proxies |
| + |
| +var target = { |
| + "target_one": 1, |
| + "property": "value" |
| +}; |
| + |
| +var handler = { "handler": 1 }; |
| + |
| +var proxy = new Proxy(target, handler); |
| +assertEquals("value", proxy.property); |
| +assertEquals(undefined, proxy.nothing); |
| +assertEquals(undefined, proxy.handler); |
| + |
| +handler.get = function() { return "value 2" }; |
| +assertEquals("value 2", proxy.property); |
| +assertEquals("value 2", proxy.nothing); |
| +assertEquals("value 2", proxy.handler); |
| + |
|
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.
|
| +var handler2 = new Proxy({"get": function() { return "value 3" }},{}); |
| +var proxy2 = new Proxy(target, handler2); |
| +assertEquals("value 3", proxy2.property); |
| +assertEquals("value 3", proxy2.nothing); |
| +assertEquals("value 3", proxy2.handler); |