diff options
author | Leonardo Balter <leonardo.balter@gmail.com> | 2015-06-02 16:53:51 -0400 |
---|---|---|
committer | Leonardo Balter <leonardo.balter@gmail.com> | 2015-06-15 22:37:56 -0400 |
commit | c3e71dcb0befd3a38378a97b3df359e9cdb18b69 (patch) | |
tree | 9d5aed9d01c5d6aef7284ea46063f5e3a6b37fc2 /test/built-ins/Proxy | |
parent | 9bbe7c6272469270c42ef3a0669597492b2d0327 (diff) | |
download | qtdeclarative-testsuites-c3e71dcb0befd3a38378a97b3df359e9cdb18b69.tar.gz |
Proxy.revocable
Diffstat (limited to 'test/built-ins/Proxy')
4 files changed, 73 insertions, 0 deletions
diff --git a/test/built-ins/Proxy/revocable/proxy.js b/test/built-ins/Proxy/revocable/proxy.js new file mode 100644 index 000000000..81a0bf54d --- /dev/null +++ b/test/built-ins/Proxy/revocable/proxy.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.2.2.1 +description: > + The returned object has a proxy property which is the created Proxy object + built with the given target and handler given parameters. +info: > + Proxy.revocable ( target, handler ) + + 6. Perform CreateDataProperty(result, "proxy", p). +---*/ + +var target = { + attr: "foo" +}; +var r = Proxy.revocable(target, { + get: function(t, prop) { + return t[prop] + "!"; + } +}); + +assert.sameValue(r.proxy.attr, "foo!"); diff --git a/test/built-ins/Proxy/revocable/revoke-consecutive-call-returns-undefined.js b/test/built-ins/Proxy/revocable/revoke-consecutive-call-returns-undefined.js new file mode 100644 index 000000000..2d54d9d71 --- /dev/null +++ b/test/built-ins/Proxy/revocable/revoke-consecutive-call-returns-undefined.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.2.2.1.1 +description: > + Calling the revoked function again will return undefined +info: > + Proxy Revocation Functions + + ... + 1. Let p be the value of F’s [[RevocableProxy]] internal slot. + 2. If p is null, return undefined. +---*/ + +var r = Proxy.revocable({}, {}); + +r.revoke(); + +assert.sameValue(r.revoke(), undefined); diff --git a/test/built-ins/Proxy/revocable/revoke-returns-undefined.js b/test/built-ins/Proxy/revocable/revoke-returns-undefined.js new file mode 100644 index 000000000..746916aab --- /dev/null +++ b/test/built-ins/Proxy/revocable/revoke-returns-undefined.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.2.2.1.1 +description: > + Calling the revoked function returns undefined +info: > + Proxy Revocation Functions + + ... + 7. Return undefined. +---*/ + +var r = Proxy.revocable({}, {}); + +assert.sameValue(r.revoke(), undefined); diff --git a/test/built-ins/Proxy/revocable/revoke.js b/test/built-ins/Proxy/revocable/revoke.js new file mode 100644 index 000000000..a39472d2b --- /dev/null +++ b/test/built-ins/Proxy/revocable/revoke.js @@ -0,0 +1,15 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.2.2.1 +description: > + The returned object has a `revoked` property which is a function +info: > + Proxy.revocable ( target, handler ) + + 7. Perform CreateDataProperty(result, "revoke", revoker). +---*/ + +var r = Proxy.revocable({}, {}); + +assert.sameValue(typeof r.revoke, "function"); |