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

Unified Diff: test/mjsunit/harmony/proxies.js

Issue 7369001: Implement delete trap for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Mads' comments. Created 9 years, 5 months 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
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/proxies.js
diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js
index 37f351317d97a975c166998b3c57e95ced3ba43d..f87d756ee1e3ce6a9374c872abd2c7a5b8899f19 100644
--- a/test/mjsunit/harmony/proxies.js
+++ b/test/mjsunit/harmony/proxies.js
@@ -289,6 +289,50 @@ TestDefine(Proxy.create({
+// Property deletion (delete).
+
+var key
+function TestDelete(handler) {
+ var o = Proxy.create(handler)
+ assertEquals(true, delete o.a)
+ assertEquals("a", key)
+ assertEquals(true, delete o["b"])
+ assertEquals("b", key)
+
+ assertEquals(false, delete o.z1)
+ assertEquals("z1", key)
+ assertEquals(false, delete o["z2"])
+ assertEquals("z2", key);
+
+ (function() {
+ "use strict"
+ assertEquals(true, delete o.c)
+ assertEquals("c", key)
+ assertEquals(true, delete o["d"])
+ assertEquals("d", key)
+
+ assertThrows(function() { delete o.z3 }, TypeError)
+ assertEquals("z3", key)
+ assertThrows(function() { delete o["z4"] }, TypeError)
+ assertEquals("z4", key)
+ })()
+}
+
+TestDelete({
+ 'delete': function(k) { key = k; return k < "z" }
+})
+TestDelete({
+ 'delete': function(k) { return this.delete2(k) },
+ delete2: function(k) { key = k; return k < "z" }
+})
+TestDelete(Proxy.create({
+ get: function(pr, pk) {
+ return function(k) { key = k; return k < "z" }
+ }
+}))
+
+
+
// Property descriptors (Object.getOwnPropertyDescriptor).
function TestDescriptor(handler) {
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698