summaryrefslogtreecommitdiff
path: root/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js')
-rw-r--r--test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js b/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js
new file mode 100644
index 000000000..aebef8756
--- /dev/null
+++ b/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.3.3.3
+description: >
+ Throws a TypeError if `this` does not have a [[WeakMapData]] internal slot.
+info: >
+ WeakMap.prototype.get ( key )
+
+ ...
+ 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError
+ exception.
+ ...
+---*/
+var map = new WeakMap();
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ map.get.call([], 1);
+});
+
+assert.throws(TypeError, function() {
+ WeakMap.prototype.get.call({}, 1);
+});
+
+assert.throws(TypeError, function() {
+ map.get.call({}, 1);
+});