Index: test/mjsunit/es6/object-tostring.js |
diff --git a/test/mjsunit/es6/object-tostring.js b/test/mjsunit/es6/object-tostring.js |
index c73a7686cdf64f42b09936f7bbd38a78da4560df..0a2f89cb88134f6393020df7cec7e11df7fd0815 100644 |
--- a/test/mjsunit/es6/object-tostring.js |
+++ b/test/mjsunit/es6/object-tostring.js |
@@ -1,8 +1,8 @@ |
-// Copyright 2014 the V8 project authors. All rights reserved. |
+// 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-tostring |
+// Flags: --harmony-tostring --harmony-proxies |
var global = this; |
@@ -137,3 +137,25 @@ function testObjectToStringOwnNonStringValue() { |
assertEquals("[object Object]", ({}).toString.call(obj)); |
} |
testObjectToStringOwnNonStringValue(); |
+ |
+ |
+// Proxies |
+ |
+function assertTag(tag, obj) { |
+ assertEquals("[object " + tag + "]", Object.prototype.toString.call(obj)); |
+} |
+ |
+assertTag("Object", new Proxy({}, {})); |
+assertTag("Array", new Proxy([], {})); |
+assertTag("Function", new Proxy(() => 42, {})); |
+assertTag("Foo", new Proxy(() => 42, {get() {return "Foo"}})); |
+assertTag("Function", new Proxy(() => 42, {get() {return 666}})); |
+ |
+revocable = Proxy.revocable([], {}); |
+revocable.revoke(); |
+assertThrows(() => Object.prototype.toString.call(revocable.proxy), TypeError); |
+ |
+handler = {}; |
+revocable = Proxy.revocable([], handler); |
+handler.get = () => revocable.revoke(); |
+assertThrows(() => Object.prototype.toString.call(revocable.proxy), TypeError); |