Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: test/mjsunit/harmony/proxy-get.js

Issue 1482283002: [runtime] [proxy] implementing [[Get]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698