diff --git a/test/built-ins/WeakMap/constructor.js b/test/built-ins/WeakMap/constructor.js new file mode 100644 index 0000000000000000000000000000000000000000..90a3ab6eaf33c34e3fdb2a4e4e516c584d3b4787 --- /dev/null +++ b/test/built-ins/WeakMap/constructor.js @@ -0,0 +1,13 @@ +// 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.1 +description: > + The WeakMap constructor is the %WeakMap% intrinsic object and the initial + value of the WeakMap property of the global object. +---*/ + +assert.sameValue( + typeof WeakMap, 'function', + 'typeof WeakMap is "function"' +); diff --git a/test/built-ins/WeakMap/empty-iterable.js b/test/built-ins/WeakMap/empty-iterable.js new file mode 100644 index 0000000000000000000000000000000000000000..045e2df5bc58f267ca79116ac360b12dec48de8c --- /dev/null +++ b/test/built-ins/WeakMap/empty-iterable.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.1.1 +description: > + If the iterable argument is empty, return new WeakMap object. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + ... + 9. Repeat + a. Let next be IteratorStep(iter). + b. ReturnIfAbrupt(next). + c. If next is false, return map. + ... +---*/ + +var counter = 0; +var set = WeakMap.prototype.set; +WeakMap.prototype.set = function(value) { + counter++; + return set.call(this, value); +}; +var map = new WeakMap([]); + +assert.sameValue(Object.getPrototypeOf(map), WeakMap.prototype); +assert(map instanceof WeakMap); +assert.sameValue( + counter, 0, + 'empty iterable does not call WeakMap.prototype.set' +); diff --git a/test/built-ins/WeakMap/get-set-method-failure.js b/test/built-ins/WeakMap/get-set-method-failure.js new file mode 100644 index 0000000000000000000000000000000000000000..b24a30069115e7175944d2a9f1429edef541a39d --- /dev/null +++ b/test/built-ins/WeakMap/get-set-method-failure.js @@ -0,0 +1,30 @@ +// 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.1.1 +description: > + Return abrupt after getting `set` method. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + ... + 5. If iterable is not present, let iterable be undefined. + 6. If iterable is either undefined or null, let iter be undefined. + 7. Else, + a. Let adder be Get(map, "set"). + b. ReturnIfAbrupt(adder). + ... +---*/ + +Object.defineProperty(WeakMap.prototype, 'set', { + get: function() { + throw new Test262Error(); + } +}); + +new WeakMap(); +new WeakMap(null); + +assert.throws(Test262Error, function() { + new WeakMap([]); +}); diff --git a/test/built-ins/WeakMap/iterable-failure.js b/test/built-ins/WeakMap/iterable-failure.js new file mode 100644 index 0000000000000000000000000000000000000000..f28e5a9b9177da7590ba6e608c0eaaa5bc95b28e --- /dev/null +++ b/test/built-ins/WeakMap/iterable-failure.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: 23.3.1.1 +description: > + If the iterable argument is undefined, return new WeakMap object. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + ... + 7. Else, + d. Let iter be GetIterator(iterable). + e. ReturnIfAbrupt(iter). + ... +---*/ + +assert.throws(TypeError, function() { + new WeakMap({}); +}); diff --git a/test/built-ins/WeakMap/iterable.js b/test/built-ins/WeakMap/iterable.js new file mode 100644 index 0000000000000000000000000000000000000000..c964e0e6d04183d06053a6e6fa2a088838bb9539 --- /dev/null +++ b/test/built-ins/WeakMap/iterable.js @@ -0,0 +1,37 @@ +// 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.1.1 +description: > + Returns the new WeakMap adding the objects from the iterable parameter. +info: > + WeakMap ( [ iterable ] ) + + ... + 9. Repeat + k. Let status be Call(adder, map, «k.[[value]], v.[[value]]»). + l. If status is an abrupt completion, return IteratorClose(iter, status). +includes: [compareArray.js] +---*/ + +var first = {}; +var second = {}; +var results = []; +var set = WeakMap.prototype.set; +WeakMap.prototype.set = function(key, value) { + results.push({ + _this: this, + key: key, + value: value + }); + return set.call(this, key, value); +}; +var map = new WeakMap([[first, 42], [second, 43]]); + +assert.sameValue(results.length, 2, 'Called WeakMap#set for each object'); +assert.sameValue(results[0].key, first, 'Adds object in order - first key'); +assert.sameValue(results[0].value, 42, 'Adds object in order - first value'); +assert.sameValue(results[0]._this, map, 'Adds object in order - this'); +assert.sameValue(results[1].key, second, 'Adds object in order - second key'); +assert.sameValue(results[1].value, 43, 'Adds object in order - second value'); +assert.sameValue(results[1]._this, map, 'Adds object in order - this'); diff --git a/test/built-ins/WeakMap/iterator-close-after-set-failure.js b/test/built-ins/WeakMap/iterator-close-after-set-failure.js new file mode 100644 index 0000000000000000000000000000000000000000..c4597f76b27525ef72016e3661949728b425f58b --- /dev/null +++ b/test/built-ins/WeakMap/iterator-close-after-set-failure.js @@ -0,0 +1,37 @@ +// 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.1.1 +description: > + Return IteratorClose(iter, status) if fail on adding value on constructing. +info: > + WeakMap ( [ iterable ] ) + + ... + 9. Repeat + k. Let status be Call(adder, map, «k.[[value]], v.[[value]]»). + l. If status is an abrupt completion, return IteratorClose(iter, status). +---*/ + +var count = 0; +var iterable = {}; +iterable[Symbol.iterator] = function() { + return { + next: function() { + return { value: [], done: false }; + }, + return: function() { + count += 1; + } + }; +}; +WeakMap.prototype.set = function() { throw new Test262Error(); }; + +assert.throws(Test262Error, function() { + new WeakMap(iterable); +}); + +assert.sameValue( + count, 1, + 'The iterator is closed when `WeakMap.prototype.set` throws an error.' +); diff --git a/test/built-ins/WeakMap/iterator-item-first-entry-returns-abrupt.js b/test/built-ins/WeakMap/iterator-item-first-entry-returns-abrupt.js new file mode 100644 index 0000000000000000000000000000000000000000..e3b9a017ba879b4fafac7ab3e0fe3acadb2b48fa --- /dev/null +++ b/test/built-ins/WeakMap/iterator-item-first-entry-returns-abrupt.js @@ -0,0 +1,47 @@ +// 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.1.1 +description: > + Closes iterator if item first entry completes abruptly. +info: > + WeakMap ( [ iterable ] ) + + ... + 9. Repeat + ... + d. Let nextItem be IteratorValue(next). + ... + g. Let k be Get(nextItem, "0"). + h. If k is an abrupt completion, return IteratorClose(iter, k). + ... +features: [Symbol.iterator] +---*/ + +var count = 0; +var item = ['foo', 'bar']; +Object.defineProperty(item, 0, { + get: function() { + throw new Test262Error(); + } +}); +var iterable = {}; +iterable[Symbol.iterator] = function() { + return { + next: function() { + return { + value: item, + done: false + }; + }, + return: function() { + count++; + } + }; +}; + +assert.throws(Test262Error, function() { + new WeakMap(iterable); +}); + +assert.sameValue(count, 1, 'The get error closed the iterator'); diff --git a/test/built-ins/WeakMap/iterator-item-second-entry-returns-abrupt.js b/test/built-ins/WeakMap/iterator-item-second-entry-returns-abrupt.js new file mode 100644 index 0000000000000000000000000000000000000000..a3e0c83e43f93b1e22aa9a5a54219025c0b58404 --- /dev/null +++ b/test/built-ins/WeakMap/iterator-item-second-entry-returns-abrupt.js @@ -0,0 +1,47 @@ +// 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.1.1 +description: > + Closes iterator if item second entry completes abruptly. +info: > + WeakMap ( [ iterable ] ) + + ... + 9. Repeat + ... + d. Let nextItem be IteratorValue(next). + ... + i. Let v be Get(nextItem, "1"). + j. If v is an abrupt completion, return IteratorClose(iter, v). + ... +features: [Symbol.iterator] +---*/ + +var count = 0; +var item = ['foo', 'bar']; +Object.defineProperty(item, 1, { + get: function() { + throw new Test262Error(); + } +}); +var iterable = {}; +iterable[Symbol.iterator] = function() { + return { + next: function() { + return { + value: item, + done: false + }; + }, + return: function() { + count++; + } + }; +}; + +assert.throws(Test262Error, function() { + new WeakMap(iterable); +}); + +assert.sameValue(count, 1, 'The get error closed the iterator'); diff --git a/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js b/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js new file mode 100644 index 0000000000000000000000000000000000000000..b50834448e86de8fed12b5dce2cefa46a3e3d9ab --- /dev/null +++ b/test/built-ins/WeakMap/iterator-items-are-not-object-close-iterator.js @@ -0,0 +1,72 @@ +// 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.1.1 +description: > + Closes the iterator object after not object error on next item. +info: > + WeakMap ( [ iterable ] ) + + ... + 9. Repeat + ... + d. Let nextItem be IteratorValue(next). + e. ReturnIfAbrupt(nextItem). + f. If Type(nextItem) is not Object, + i. Let error be Completion{[[type]]: throw, [[value]]: a newly created + TypeError object, [[target]]:empty}. + ii. Return IteratorClose(iter, error). +features: + - Symbol + - Symbol.iterator +---*/ + +var count = 0; +var nextItem; +var iterable = {}; +iterable[Symbol.iterator] = function() { + return { + next: function() { + return { value: nextItem, done: false }; + }, + return: function() { + count += 1; + } + }; +}; + +nextItem = 1; +assert.throws(TypeError, function() { + new WeakMap(iterable); +}); +assert.sameValue(count, 1); + +nextItem = true; +assert.throws(TypeError, function() { + new WeakMap(iterable); +}); +assert.sameValue(count, 2); + +nextItem = ''; +assert.throws(TypeError, function() { + new WeakMap(iterable); +}); +assert.sameValue(count, 3); + +nextItem = null; +assert.throws(TypeError, function() { + new WeakMap(iterable); +}); +assert.sameValue(count, 4); + +nextItem = undefined; +assert.throws(TypeError, function() { + new WeakMap(iterable); +}); +assert.sameValue(count, 5); + +nextItem = Symbol('a'); +assert.throws(TypeError, function() { + new WeakMap(iterable); +}); +assert.sameValue(count, 6); diff --git a/test/built-ins/WeakMap/iterator-items-are-not-object.js b/test/built-ins/WeakMap/iterator-items-are-not-object.js new file mode 100644 index 0000000000000000000000000000000000000000..be1904a66cc85ac530c011665a2634d58f479973 --- /dev/null +++ b/test/built-ins/WeakMap/iterator-items-are-not-object.js @@ -0,0 +1,48 @@ +// 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.1.1 +description: > + Throws a TypeError if iterable itens are not Objects. +info: > + WeakMap ( [ iterable ] ) + + ... + 9. Repeat + ... + d. Let nextItem be IteratorValue(next). + e. ReturnIfAbrupt(nextItem). + f. If Type(nextItem) is not Object, + i. Let error be Completion{[[type]]: throw, [[value]]: a newly created + TypeError object, [[target]]:empty}. + ii. Return IteratorClose(iter, error). +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + new WeakMap([1, 1]); +}); + +assert.throws(TypeError, function() { + new WeakMap(['', 1]); +}); + +assert.throws(TypeError, function() { + new WeakMap([true, 1]); +}); + +assert.throws(TypeError, function() { + new WeakMap([null, 1]); +}); + +assert.throws(TypeError, function() { + new WeakMap([Symbol('a'), 1]); +}); + +assert.throws(TypeError, function() { + new WeakMap([undefined, 1]); +}); + +assert.throws(TypeError, function() { + new WeakMap([['a', 1], 2]); +}); diff --git a/test/built-ins/WeakMap/iterator-next-failure.js b/test/built-ins/WeakMap/iterator-next-failure.js new file mode 100644 index 0000000000000000000000000000000000000000..cb084f0907df0a37f8aca9116fc0227a23cea91b --- /dev/null +++ b/test/built-ins/WeakMap/iterator-next-failure.js @@ -0,0 +1,28 @@ +// 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.1.1 +description: > + Return abrupt from next iterator step. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + ... + 9. Repeat + a. Let next be IteratorStep(iter). + b. ReturnIfAbrupt(next). + ... +---*/ + +var iterable = {}; +iterable[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + new WeakMap(iterable); +}); diff --git a/test/built-ins/WeakMap/iterator-value-failure.js b/test/built-ins/WeakMap/iterator-value-failure.js new file mode 100644 index 0000000000000000000000000000000000000000..7a0626dd4262e551acaffc01b65f2b79b779e6d3 --- /dev/null +++ b/test/built-ins/WeakMap/iterator-value-failure.js @@ -0,0 +1,34 @@ +// 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.1.1 +description: > + If the iterable argument is empty, return new WeakMap object. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + ... + 9. Repeat + ... + d. Let nextItem be IteratorValue(next). + e. ReturnIfAbrupt(nextItem). + ... +---*/ + +var iterable = {}; +iterable[Symbol.iterator] = function() { + return { + next: function() { + return { + get value() { + throw new Test262Error(); + }, + done: false + }; + } + }; +}; + +assert.throws(Test262Error, function() { + new WeakMap(iterable); +}); diff --git a/test/built-ins/WeakMap/length.js b/test/built-ins/WeakMap/length.js new file mode 100644 index 0000000000000000000000000000000000000000..2db93622b8d0fc3619d3f83966b16d3d96714b53 --- /dev/null +++ b/test/built-ins/WeakMap/length.js @@ -0,0 +1,14 @@ +// 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.2 +description: > + The length property of the WeakMap constructor is 0. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(WeakMap.length, 0, 'The value of `WeakMap.length` is `0`'); + +verifyNotEnumerable(WeakMap, 'length'); +verifyNotWritable(WeakMap, 'length'); +verifyConfigurable(WeakMap, 'length'); diff --git a/test/built-ins/WeakMap/name.js b/test/built-ins/WeakMap/name.js new file mode 100644 index 0000000000000000000000000000000000000000..75d24e2bbc7b292e3ddaf682556fd1710692c8b6 --- /dev/null +++ b/test/built-ins/WeakMap/name.js @@ -0,0 +1,20 @@ +// 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.1.1 +description: > + WeakMap ( [ iterable ] ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.name, 'WeakMap', + 'The value of `WeakMap.name` is "WeakMap"' +); + +verifyNotEnumerable(WeakMap, 'name'); +verifyNotWritable(WeakMap, 'name'); +verifyConfigurable(WeakMap, 'name'); diff --git a/test/built-ins/WeakMap/no-iterable.js b/test/built-ins/WeakMap/no-iterable.js new file mode 100644 index 0000000000000000000000000000000000000000..229a28fde2f0bc187b1246c258710ed7c2e82c3d --- /dev/null +++ b/test/built-ins/WeakMap/no-iterable.js @@ -0,0 +1,24 @@ +// 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.1.1 +description: > + If the iterable argument is undefined, return new WeakMap object. +info: > + WeakMap ( [ iterable ] ) + + ... + 5. If iterable is not present, let iterable be undefined. + 6. If iterable is either undefined or null, let iter be undefined. + ... + 8. If iter is undefined, return map. + ... +---*/ + +var a = new WeakMap(); +var b = new WeakMap(undefined); +var c = new WeakMap(null); + +assert.sameValue(Object.getPrototypeOf(a), WeakMap.prototype); +assert.sameValue(Object.getPrototypeOf(b), WeakMap.prototype); +assert.sameValue(Object.getPrototypeOf(c), WeakMap.prototype); diff --git a/test/built-ins/WeakMap/properties-of-map-instances.js b/test/built-ins/WeakMap/properties-of-map-instances.js new file mode 100644 index 0000000000000000000000000000000000000000..f928f0bec4e3e08c64e4374bdbe2c26dcaa38949 --- /dev/null +++ b/test/built-ins/WeakMap/properties-of-map-instances.js @@ -0,0 +1,14 @@ +// 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.4 +description: > + WeakMap instances are ordinary objects that inherit properties from the + WeakMap prototype. +---*/ + +assert.sameValue( + Object.getPrototypeOf(new WeakMap()), + WeakMap.prototype, + '`Object.getPrototypeOf(new WeakMap())` returns `WeakMap.prototype`' +); diff --git a/test/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.js b/test/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.js new file mode 100644 index 0000000000000000000000000000000000000000..bebb9f9454b7ce14285f1c16757dac29a05af589 --- /dev/null +++ b/test/built-ins/WeakMap/properties-of-the-weakmap-prototype-object.js @@ -0,0 +1,20 @@ +// 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 +description: > + The WeakMap.prototype's prototype is Object.prototype. +info: > + 23.3.3 Properties of the WeakMap Prototype Object + + The WeakMap prototype object is the intrinsic object %WeakMapPrototype%. The + value of the [[Prototype]] internal slot of the WeakMap prototype object is + the intrinsic object %ObjectPrototype% (19.1.3). The WeakMap prototype object + is an ordinary object. It does not have a [[WeakMapData]] internal slot. +---*/ + +assert.sameValue( + Object.getPrototypeOf(WeakMap.prototype), + Object.prototype, + '`Object.getPrototypeOf(WeakMap.prototype)` returns `Object.prototype`' +); diff --git a/test/built-ins/WeakMap/prototype-of-weakmap.js b/test/built-ins/WeakMap/prototype-of-weakmap.js new file mode 100644 index 0000000000000000000000000000000000000000..c93853eb23d4cc001a090d882b8cf76fab778ddb --- /dev/null +++ b/test/built-ins/WeakMap/prototype-of-weakmap.js @@ -0,0 +1,14 @@ +// 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.2 +description: > + The value of the [[Prototype]] internal slot of the WeakMap constructor is the + intrinsic object %FunctionPrototype% (19.2.3). +---*/ + +assert.sameValue( + Object.getPrototypeOf(WeakMap), + Function.prototype, + '`Object.getPrototypeOf(WeakMap)` returns `Function.prototype`' +); diff --git a/test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js b/test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js new file mode 100644 index 0000000000000000000000000000000000000000..ef26cc6af667514cedaccde938f2c935cba18c21 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js @@ -0,0 +1,26 @@ +// 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.6 +description: "WeakMap#@@toStringTag value and writability" +info: > + WeakMap.prototype [ @@toStringTag ] + + The initial value of the @@toStringTag property is the String value "WeakMap". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] + ---*/ + +var WeakMapProto = WeakMap.prototype; + +assert.sameValue( + WeakMapProto[Symbol.toStringTag], + 'WeakMap', + 'The value of WeakMap.prototype[Symbol.toStringTag] is "WeakMap"' +); + +verifyNotEnumerable(WeakMapProto, Symbol.toStringTag); +verifyNotWritable(WeakMapProto, Symbol.toStringTag); +verifyConfigurable(WeakMapProto, Symbol.toStringTag); diff --git a/test/built-ins/WeakMap/prototype/constructor.js b/test/built-ins/WeakMap/prototype/constructor.js new file mode 100644 index 0000000000000000000000000000000000000000..19ee90ee0dc56d14501e58d82dbf049ef2a83436 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/constructor.js @@ -0,0 +1,21 @@ +// 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.1 +description: > + WeakMap.prototype.constructor value and property descriptor +info: > + The initial value of WeakMap.prototype.constructor is the %WeakMap% + intrinsic object. + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue(WeakMap.prototype.constructor, WeakMap); +assert.sameValue((new WeakMap()).constructor, WeakMap); + +verifyNotEnumerable(WeakMap.prototype, 'constructor'); +verifyWritable(WeakMap.prototype, 'constructor'); +verifyConfigurable(WeakMap.prototype, 'constructor'); diff --git a/test/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js b/test/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js new file mode 100644 index 0000000000000000000000000000000000000000..b5858f5f28ae9fbea8b7e75775dbe0fb478940db --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js @@ -0,0 +1,29 @@ +// 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.2 +description: > + Delete an entry from initial iterable. +info: > + WeakMap.prototype.delete ( value ) + + ... + 5. Let entries be the List that is the value of M’s [[WeakMapData]] internal + slot. + 6. If Type(key) is not Object, return false. + 7. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, then + i. Set p.[[key]] to empty. + ii. Set p.[[value]] to empty. + iii. Return true. + ... +---*/ + +var foo = {}; +var map = new WeakMap([[foo, 42]]); + +var result = map.delete(foo); + +assert.sameValue(map.has(foo), false); +assert.sameValue(result, true, 'WeakMap#delete returns true'); diff --git a/test/built-ins/WeakMap/prototype/delete/delete-entry.js b/test/built-ins/WeakMap/prototype/delete/delete-entry.js new file mode 100644 index 0000000000000000000000000000000000000000..8faa832ff9d5f72fc09837299ecfce13e9041808 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/delete-entry.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.2 +description: > + Delete an entry. +info: > + WeakMap.prototype.delete ( value ) + + ... + 5. Let entries be the List that is the value of M’s [[WeakMapData]] internal + slot. + 6. If Type(key) is not Object, return false. + 7. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, then + i. Set p.[[key]] to empty. + ii. Set p.[[value]] to empty. + iii. Return true. + ... +---*/ + +var foo = {}; +var map = new WeakMap(); + +map.set(foo, 42); + +var result = map.delete(foo); + +assert.sameValue(map.has(foo), false); +assert.sameValue(result, true, 'WeakMap#delete returns true'); diff --git a/test/built-ins/WeakMap/prototype/delete/delete.js b/test/built-ins/WeakMap/prototype/delete/delete.js new file mode 100644 index 0000000000000000000000000000000000000000..a75c7af1d5e7e150496d01b21f26565f5582f14e --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/delete.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: 23.3.3.2 +description: > + WeakMap.prototype.delete property descriptor +info: > + WeakMap.prototype.delete ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + typeof WeakMap.prototype.delete, + 'function', + 'typeof WeakMap.prototype.delete is "function"' +); + +verifyNotEnumerable(WeakMap.prototype, 'delete'); +verifyWritable(WeakMap.prototype, 'delete'); +verifyConfigurable(WeakMap.prototype, 'delete'); diff --git a/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.js b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.js new file mode 100644 index 0000000000000000000000000000000000000000..8cc80bf620df7043d11420b7b5a5c4b52fe1696e --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-array.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: 23.3.3.2 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.delete ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call([], {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call([], {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.js b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.js new file mode 100644 index 0000000000000000000000000000000000000000..cb5807eee724878902219bd7d5142b2b0ab2b7cb --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-map.js @@ -0,0 +1,24 @@ +// 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.2 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.delete ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Map] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(new Map(), {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(new Map(), {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-object.js b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-object.js new file mode 100644 index 0000000000000000000000000000000000000000..94d6dcaed95ff3bffe2ebde20e3c5cc97ff46b2f --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-object.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: 23.3.3.2 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.delete ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call({}, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call({}, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-set.js b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-set.js new file mode 100644 index 0000000000000000000000000000000000000000..c523557f9100e9f03431e7251c9ae1399e2f5138 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-set.js @@ -0,0 +1,24 @@ +// 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.2 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.delete ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Set] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(new Set(), {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(new Set(), {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..5ed3f33f4d32f334c5472116545cb05bcb4ac290 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/does-not-have-weakmapdata-internal-slot-weakmap-prototype.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: 23.3.3.2 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.delete ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(WeakMap.prototype, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(WeakMap.prototype, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/length.js b/test/built-ins/WeakMap/prototype/delete/length.js new file mode 100644 index 0000000000000000000000000000000000000000..ff5dc74d82a8adbf0d9708f9607ec4db696ccfd9 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/length.js @@ -0,0 +1,22 @@ +// 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.2 +description: > + WeakMap.prototype.delete.length value and writability. +info: > + WeakMap.prototype.delete ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.delete.length, 1, + 'The value of WeakMap.prototype.delete.length is 1' +); + +verifyNotEnumerable(WeakMap.prototype.delete, 'length'); +verifyNotWritable(WeakMap.prototype.delete, 'length'); +verifyConfigurable(WeakMap.prototype.delete, 'length'); diff --git a/test/built-ins/WeakMap/prototype/delete/name.js b/test/built-ins/WeakMap/prototype/delete/name.js new file mode 100644 index 0000000000000000000000000000000000000000..31d28f728d96dd7e1f8668fb8d189ecf681eeb8c --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/name.js @@ -0,0 +1,22 @@ +// 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.2 +description: > + WeakMap.prototype.delete.name value and writability. +info: > + WeakMap.prototype.delete ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.delete.name, 'delete', + 'The value of WeakMap.prototype.delete.name is "delete"' +); + +verifyNotEnumerable(WeakMap.prototype.delete, 'name'); +verifyNotWritable(WeakMap.prototype.delete, 'name'); +verifyConfigurable(WeakMap.prototype.delete, 'name'); diff --git a/test/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.js b/test/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.js new file mode 100644 index 0000000000000000000000000000000000000000..b51ce2588322909bb7bf42bba3fb367137aa0c8c --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/returns-false-value-is-not-object.js @@ -0,0 +1,22 @@ +// 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.2 +description: > + Return false if value is not an Object. +info: > + WeakMap.prototype.delete ( value ) + + 5. If Type(key) is not Object, return false. +features: [Symbol] +---*/ + +var map = new WeakMap(); + +assert.sameValue(map.delete(1), false); +assert.sameValue(map.delete(''), false); +assert.sameValue(map.delete(NaN), false); +assert.sameValue(map.delete(null), false); +assert.sameValue(map.delete(undefined), false); +assert.sameValue(map.delete(true), false); +assert.sameValue(map.delete(Symbol()), false); diff --git a/test/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.js b/test/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.js new file mode 100644 index 0000000000000000000000000000000000000000..2e0bee90921a68cc36ee857e1d8d633fcf46c8ba --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/returns-false-when-delete-is-noop.js @@ -0,0 +1,21 @@ +// 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.2 +description: > + Return false if entry is not in the WeakMap. +info: > + WeakMap.prototype.delete ( value ) + + ... + 7. Return false. + +---*/ + +var map = new WeakMap(); +var foo = {}; +var bar = {}; + +map.set(foo, 42); + +assert.sameValue(map.delete(bar), false); diff --git a/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.js b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.js new file mode 100644 index 0000000000000000000000000000000000000000..cdb94487c1cf54720917ec7dfd50816bcf8b62c6 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-boolean.js @@ -0,0 +1,20 @@ +// 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.2 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.delete ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(false, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(false, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.js b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.js new file mode 100644 index 0000000000000000000000000000000000000000..0cdb8ae6817e36287e8aaed4fca748fbe1979dab --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-null.js @@ -0,0 +1,20 @@ +// 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.2 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.delete ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(null, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(null, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.js b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.js new file mode 100644 index 0000000000000000000000000000000000000000..2143ede79d9fb5358a16f19aacb7dc0da1f9aeb5 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-number.js @@ -0,0 +1,20 @@ +// 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.2 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.delete ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(0, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(0, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.js b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.js new file mode 100644 index 0000000000000000000000000000000000000000..1ee40def3c081894fa93d8975e729ae95f9e53af --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-string.js @@ -0,0 +1,20 @@ +// 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.2 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.delete ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call('', {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call('', {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.js b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.js new file mode 100644 index 0000000000000000000000000000000000000000..a368da9d6c38c78f15de20fe98b3394100f9b73a --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-symbol.js @@ -0,0 +1,21 @@ +// 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.2 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.delete ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(Symbol(), {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(Symbol(), {}); +}); diff --git a/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.js b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..30317c132d1a7e20d684d17c9f96eaaf95d0edf4 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/delete/this-not-object-throw-undefined.js @@ -0,0 +1,20 @@ +// 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.2 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.delete ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.delete.call(undefined, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.delete.call(undefined, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.js b/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.js new file mode 100644 index 0000000000000000000000000000000000000000..1bbc12bcc268687d4b41f491bb6c4684237fde3a --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-map.js @@ -0,0 +1,24 @@ +// 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` is a Map object. +info: > + WeakMap.prototype.get ( key ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Map] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(new Map(), 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.get.call(new Map(), 1); +}); diff --git a/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-set.js b/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-set.js new file mode 100644 index 0000000000000000000000000000000000000000..a317baf680106af67c837655791d33b7d581587a --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/does-not-have-weakmapdata-internal-slot-set.js @@ -0,0 +1,24 @@ +// 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` is a Set object. +info: > + WeakMap.prototype.get ( key ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Set] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(new Set(), 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.get.call(new Set(), 1); +}); 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 0000000000000000000000000000000000000000..aebef875697c3a3cffc3e7dd966cb901e8e87460 --- /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); +}); diff --git a/test/built-ins/WeakMap/prototype/get/get.js b/test/built-ins/WeakMap/prototype/get/get.js new file mode 100644 index 0000000000000000000000000000000000000000..e2610284de761a57779b3cdab019a48bb6eed631 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/get.js @@ -0,0 +1,22 @@ +// 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: > + Property type and descriptor. +info: > + WeakMap.prototype.get ( key ) + + 17 ECMAScript Standard Built-in Objects +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + typeof WeakMap.prototype.get, + 'function', + '`typeof WeakMap.prototype.get` is `function`' +); + +verifyNotEnumerable(WeakMap.prototype, 'get'); +verifyWritable(WeakMap.prototype, 'get'); +verifyConfigurable(WeakMap.prototype, 'get'); diff --git a/test/built-ins/WeakMap/prototype/get/length.js b/test/built-ins/WeakMap/prototype/get/length.js new file mode 100644 index 0000000000000000000000000000000000000000..48ed357af2ca04e2a2f146216fc6eec9799cf5b3 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/length.js @@ -0,0 +1,22 @@ +// 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: > + WeakMap.prototype.get.length value and descriptor. +info: > + WeakMap.prototype.get ( key ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.get.length, 1, + 'The value of `WeakMap.prototype.get.length` is `1`' +); + +verifyNotEnumerable(WeakMap.prototype.get, 'length'); +verifyNotWritable(WeakMap.prototype.get, 'length'); +verifyConfigurable(WeakMap.prototype.get, 'length'); diff --git a/test/built-ins/WeakMap/prototype/get/name.js b/test/built-ins/WeakMap/prototype/get/name.js new file mode 100644 index 0000000000000000000000000000000000000000..28ed494c1e767eed6c578812355b516eeab46a31 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/name.js @@ -0,0 +1,22 @@ +// 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: > + WeakMap.prototype.get.name value and descriptor. +info: > + WeakMap.prototype.get ( key ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.get.name, 'get', + 'The value of `WeakMap.prototype.get.name` is `"get"`' +); + +verifyNotEnumerable(WeakMap.prototype.get, 'name'); +verifyNotWritable(WeakMap.prototype.get, 'name'); +verifyConfigurable(WeakMap.prototype.get, 'name'); diff --git a/test/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.js b/test/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.js new file mode 100644 index 0000000000000000000000000000000000000000..07852697568039e271c399083d506525eef047cd --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/returns-undefined-key-is-not-object.js @@ -0,0 +1,41 @@ +// 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: > + Returns undefined when key is not an Object. +info: > + WeakMap.prototype.get ( key ) + + ... + 4. Let entries be the List that is the value of M’s [[WeakMapData]] internal + slot. + 5. If Type(key) is not Object, return undefined. + ... +---*/ + +var map = new WeakMap(); + +assert.sameValue(map.get(null), undefined, 'Returns undefined if key is null'); + +assert.sameValue(map.get(NaN), undefined, 'Returns undefined if key is NaN'); + +assert.sameValue( + map.get('foo'), undefined, + 'Returns undefined if key is a String' +); + +assert.sameValue( + map.get(1), undefined, + 'Returns undefined if key is a Number' +); + +assert.sameValue( + map.get(undefined), undefined, + 'Returns undefined if key is undefined' +); + +assert.sameValue( + map.get(Symbol()), undefined, + 'Returns undefined if key is a Symbol' +); diff --git a/test/built-ins/WeakMap/prototype/get/returns-undefined.js b/test/built-ins/WeakMap/prototype/get/returns-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..ff3b22cd6a03e6e34d312ca62c135f2e0336eeb8 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/returns-undefined.js @@ -0,0 +1,37 @@ +// 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: > + Returns undefined when key is not on the WeakMap object. +info: > + WeakMap.prototype.get ( key ) + + 4. Let entries be the List that is the value of M’s [[WeakMapData]] internal + slot. + 5. If Type(key) is not Object, return undefined. + 6. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return + p.[[value]]. + 7. Return undefined. + ... +---*/ + +var map = new WeakMap(); +var key = {}; + +assert.sameValue( + map.get(key), undefined, + 'returns undefined if key is not on the weakmap' +); + +map.set(key, 1); +map.set({}, 2); +map.delete(key); +map.set({}, 3); + +assert.sameValue( + map.get(key), undefined, + 'returns undefined if key was deleted' +); diff --git a/test/built-ins/WeakMap/prototype/get/returns-value.js b/test/built-ins/WeakMap/prototype/get/returns-value.js new file mode 100644 index 0000000000000000000000000000000000000000..143e641219ac177cf63ef6d8f939ad2a00a6a788 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/returns-value.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: > + Returns the value from the specified key +info: > + WeakMap.prototype.get ( key ) + + 4. Let entries be the List that is the value of M’s [[WeakMapData]] internal + slot. + 5. If Type(key) is not Object, return undefined. + 6. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return + p.[[value]]. + ... +---*/ + +var foo = {}; +var bar = {}; +var baz = []; +var map = new WeakMap([[foo,0]]); + +assert.sameValue(map.get(foo), 0); + +map.set(bar, 1); +assert.sameValue(map.get(bar), 1); + +map.set(baz, 2); +assert.sameValue(map.get(baz), 2); diff --git a/test/built-ins/WeakMap/prototype/get/this-not-object-throw.js b/test/built-ins/WeakMap/prototype/get/this-not-object-throw.js new file mode 100644 index 0000000000000000000000000000000000000000..7113ae22f27d4bef5bb4c5fe42011e00cbc17371 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/get/this-not-object-throw.js @@ -0,0 +1,43 @@ +// 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` value is not an Object. +info: > + WeakMap.prototype.get ( key ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. + ... +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(false, {}); +}); + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(1, {}); +}); + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call('', {}); +}); + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(undefined, {}); +}); + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(null, {}); +}); + +assert.throws(TypeError, function() { + WeakMap.prototype.get.call(Symbol(), {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.get.call(false, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.js b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.js new file mode 100644 index 0000000000000000000000000000000000000000..33dc84e34205bc70701e9d9c4a3ed786a9f233e9 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-array.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: 23.3.3.4 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.has ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call([], {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call([], {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.js b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.js new file mode 100644 index 0000000000000000000000000000000000000000..5fd060eac756e9c1ec011ca4a3e1b245438404eb --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-map.js @@ -0,0 +1,24 @@ +// 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.4 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.has ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Map] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(new Map(), {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(new Map(), {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-object.js b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-object.js new file mode 100644 index 0000000000000000000000000000000000000000..013b2478702e6eb1de8193e1e2a61eb464ae140e --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-object.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: 23.3.3.4 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.has ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call({}, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call({}, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-set.js b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-set.js new file mode 100644 index 0000000000000000000000000000000000000000..1f9bb68aeed5a8e427661a7aec400900b0ba7827 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-set.js @@ -0,0 +1,24 @@ +// 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.4 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.has ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Set] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(new Set(), {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(new Set(), {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..297b9da18301a85d446d9a6d9548d1aac0291f16 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/does-not-have-weakmapdata-internal-slot-weakmap-prototype.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: 23.3.3.4 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.has ( value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(WeakMap.prototype, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(WeakMap.prototype, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/has/has.js b/test/built-ins/WeakMap/prototype/has/has.js new file mode 100644 index 0000000000000000000000000000000000000000..9567bb7cf7cbdab7225af657a4c56b825c383d0b --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/has.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: 23.3.3.4 +description: > + WeakMap.prototype.has property descriptor +info: > + WeakMap.prototype.has ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + typeof WeakMap.prototype.has, + 'function', + 'typeof WeakMap.prototype.has is "function"' +); + +verifyNotEnumerable(WeakMap.prototype, 'has'); +verifyWritable(WeakMap.prototype, 'has'); +verifyConfigurable(WeakMap.prototype, 'has'); diff --git a/test/built-ins/WeakMap/prototype/has/length.js b/test/built-ins/WeakMap/prototype/has/length.js new file mode 100644 index 0000000000000000000000000000000000000000..17291222b98a0463227c5bcf2f7eba220163cc57 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/length.js @@ -0,0 +1,22 @@ +// 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.4 +description: > + WeakMap.prototype.has.length value and writability. +info: > + WeakMap.prototype.has ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.has.length, 1, + 'The value of WeakMap.prototype.has.length is 1' +); + +verifyNotEnumerable(WeakMap.prototype.has, 'length'); +verifyNotWritable(WeakMap.prototype.has, 'length'); +verifyConfigurable(WeakMap.prototype.has, 'length'); diff --git a/test/built-ins/WeakMap/prototype/has/name.js b/test/built-ins/WeakMap/prototype/has/name.js new file mode 100644 index 0000000000000000000000000000000000000000..04c7c0e0fd69199b8d5945909affb855bfab52ee --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/name.js @@ -0,0 +1,22 @@ +// 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.4 +description: > + WeakMap.prototype.has.name value and writability. +info: > + WeakMap.prototype.has ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.has.name, 'has', + 'The value of WeakMap.prototype.has.name is "has"' +); + +verifyNotEnumerable(WeakMap.prototype.has, 'name'); +verifyNotWritable(WeakMap.prototype.has, 'name'); +verifyConfigurable(WeakMap.prototype.has, 'name'); diff --git a/test/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.js b/test/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.js new file mode 100644 index 0000000000000000000000000000000000000000..e721e1506921eb138eac9538987e9cc4e6a21e64 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/returns-false-when-value-is-not-object.js @@ -0,0 +1,21 @@ +// 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.4 +description: > + Returns false if value is not an Object. +info: > + WeakMap.prototype.has ( value ) + + 5. If Type(key) is not Object, return false. +features: [Symbol] +---*/ + +var map = new WeakMap(); + +assert.sameValue(map.has(1), false); +assert.sameValue(map.has(''), false); +assert.sameValue(map.has(null), false); +assert.sameValue(map.has(undefined), false); +assert.sameValue(map.has(true), false); +assert.sameValue(map.has(Symbol()), false); diff --git a/test/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.js b/test/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.js new file mode 100644 index 0000000000000000000000000000000000000000..adce12027d2488fe4037c6a38898b2323b1893fa --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/returns-false-when-value-not-present.js @@ -0,0 +1,25 @@ +// 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.4 +description: > + Return false when value is not present in the WeakMap entries. +info: > + WeakMap.prototype.has ( value ) + + ... + 7. Return false. + +---*/ + +var foo = {}; +var bar = {}; +var map = new WeakMap(); + +assert.sameValue(map.has(foo), false); + +map.set(foo, 1); +assert.sameValue(map.has(bar), false); + +map.delete(foo); +assert.sameValue(map.has(foo), false); diff --git a/test/built-ins/WeakMap/prototype/has/returns-true-when-value-present.js b/test/built-ins/WeakMap/prototype/has/returns-true-when-value-present.js new file mode 100644 index 0000000000000000000000000000000000000000..07724ea278accd8ba597e5d89f56a6cd0c0ee2f6 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/returns-true-when-value-present.js @@ -0,0 +1,22 @@ +// 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.4 +description: > + Returns true when value is present in the WeakMap entries list. +info: > + WeakMap.prototype.has ( value ) + + ... + 6. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return + true. + ... +---*/ + +var foo = {}; +var map = new WeakMap(); + +map.set(foo, 1); +assert.sameValue(map.has(foo), true); diff --git a/test/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.js b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.js new file mode 100644 index 0000000000000000000000000000000000000000..6d6f862f02495b3f1157e7f301ab2e5c1112eb68 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-boolean.js @@ -0,0 +1,21 @@ +// 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.4 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.has ( value ) + + 1. Let S be the this value. + 2. If Type(S) is not Object, throw a TypeError exception. + +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(false, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(false, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/has/this-not-object-throw-null.js b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-null.js new file mode 100644 index 0000000000000000000000000000000000000000..8f7863016f75e427a4cdf583edadadd7ca91731b --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-null.js @@ -0,0 +1,20 @@ +// 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.4 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.has ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(null, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(null, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/has/this-not-object-throw-number.js b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-number.js new file mode 100644 index 0000000000000000000000000000000000000000..b6bb5c9830dd8566bcdefdf72e7a1f9cfc4cdd2f --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-number.js @@ -0,0 +1,20 @@ +// 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.4 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.has ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(0, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(0, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/has/this-not-object-throw-string.js b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-string.js new file mode 100644 index 0000000000000000000000000000000000000000..5b44cdb08d4c25ff28b2e1459524179c77ac4572 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-string.js @@ -0,0 +1,20 @@ +// 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.4 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.has ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call('', {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call('', {}); +}); diff --git a/test/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.js b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.js new file mode 100644 index 0000000000000000000000000000000000000000..1eb3680cbc406923dcbcc1de0a81948ed8d26cae --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-symbol.js @@ -0,0 +1,21 @@ +// 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.4 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.has ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(Symbol(), {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(Symbol(), {}); +}); diff --git a/test/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.js b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..2c8fb4be06ccc3496b9322c28889b6b4bd46cc3c --- /dev/null +++ b/test/built-ins/WeakMap/prototype/has/this-not-object-throw-undefined.js @@ -0,0 +1,20 @@ +// 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.4 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.has ( value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.has.call(undefined, {}); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.has.call(undefined, {}); +}); diff --git a/test/built-ins/WeakMap/prototype/prototype-attributes.js b/test/built-ins/WeakMap/prototype/prototype-attributes.js new file mode 100644 index 0000000000000000000000000000000000000000..19941f4ce52a123aecb6b022bd36fa12abcb04bc --- /dev/null +++ b/test/built-ins/WeakMap/prototype/prototype-attributes.js @@ -0,0 +1,12 @@ +// 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.2.1 +description: > + WeakMap.prototype is not writable, not enumerable and not configurable. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(WeakMap, 'prototype'); +verifyNotWritable(WeakMap, 'prototype'); +verifyNotConfigurable(WeakMap, 'prototype'); diff --git a/test/built-ins/WeakMap/prototype/set/adds-element.js b/test/built-ins/WeakMap/prototype/set/adds-element.js new file mode 100644 index 0000000000000000000000000000000000000000..0b0d86f63e4d20ddc9d2576fa515cf87dc8e6871 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/adds-element.js @@ -0,0 +1,27 @@ +// 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.5 +description: > + Appends value as the last element of entries. +info: > + WeakMap.prototype.set ( key, value ) + + ... + 7. Let p be the Record {[[key]]: key, [[value]]: value}. + 8. Append p as the last element of entries. + ... +---*/ + +var map = new WeakMap(); +var foo = {}; +var bar = {}; +var baz = {}; + +map.set(foo, 1); +map.set(bar, 2); +map.set(baz, 3); + +assert(map.has(foo)); +assert(map.has(bar)); +assert(map.has(baz)); diff --git a/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.js b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.js new file mode 100644 index 0000000000000000000000000000000000000000..b98e11d2fda6fd2fa07f9476d88c2b6677350260 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-array.js @@ -0,0 +1,24 @@ +// 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.5 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.set ( key, value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... + +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call([], {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call([], {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.js b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.js new file mode 100644 index 0000000000000000000000000000000000000000..b17dbc7f63e749ee9ab27283630b3429bd4c4ed0 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-map.js @@ -0,0 +1,24 @@ +// 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.5 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.set ( key, value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Map] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(new Map(), {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(new Map(), {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-object.js b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-object.js new file mode 100644 index 0000000000000000000000000000000000000000..5adc57bc5946acf2ab9d5cd881478efb8cfda294 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-object.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: 23.3.3.5 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.set ( key, value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call({}, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call({}, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-set.js b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-set.js new file mode 100644 index 0000000000000000000000000000000000000000..0ef36a59371abb605399a37eaa0bc37e1d86ce30 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-set.js @@ -0,0 +1,24 @@ +// 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.5 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.set ( key, value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +features: [Set] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(new Set(), {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(new Set(), {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js new file mode 100644 index 0000000000000000000000000000000000000000..59d4308dde8b85072751146d3f48ad6cddfcbc74 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/does-not-have-weakmapdata-internal-slot-weakmap-prototype.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: 23.3.3.5 +description: > + Throws TypeError if `this` doesn't have a [[WeakMapData]] internal slot. +info: > + WeakMap.prototype.set ( key, value ) + + ... + 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError + exception. + ... +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(WeakMap.prototype, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(WeakMap.prototype, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/key-not-object-throw.js b/test/built-ins/WeakMap/prototype/set/key-not-object-throw.js new file mode 100644 index 0000000000000000000000000000000000000000..4b4031d1c58433f6d80bebfccd506e2f0a74da75 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/key-not-object-throw.js @@ -0,0 +1,37 @@ +// 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.5 +description: Throws TypeError if `key` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 5. If Type(key) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +var s = new WeakMap(); + +assert.throws(TypeError, function() { + s.set(1, 1); +}); + +assert.throws(TypeError, function() { + s.set(false, 1); +}); + +assert.throws(TypeError, function() { + s.set(undefined, 1); +}); + +assert.throws(TypeError, function() { + s.set('string', 1); +}); + +assert.throws(TypeError, function() { + s.set(null, 1); +}); + +assert.throws(TypeError, function() { + s.set(Symbol(), 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/length.js b/test/built-ins/WeakMap/prototype/set/length.js new file mode 100644 index 0000000000000000000000000000000000000000..0d687e51f21fda4ac3428a24cd14b571331d6644 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/length.js @@ -0,0 +1,21 @@ +// 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.5 +description: WeakMap.prototype.set.length descriptor +info: > + WeakMap.prototype.set ( key, value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.set.length, 2, + 'The value of `WeakMap.prototype.set.length` is `2`' +); + +verifyNotEnumerable(WeakMap.prototype.set, 'length'); +verifyNotWritable(WeakMap.prototype.set, 'length'); +verifyConfigurable(WeakMap.prototype.set, 'length'); diff --git a/test/built-ins/WeakMap/prototype/set/name.js b/test/built-ins/WeakMap/prototype/set/name.js new file mode 100644 index 0000000000000000000000000000000000000000..9c4f63080fe4ccd8d6974908702d1a47573992bf --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/name.js @@ -0,0 +1,21 @@ +// 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.5 +description: WeakMap.prototype.set.name descriptor +info: > + WeakMap.prototype.set ( value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + WeakMap.prototype.set.name, 'set', + 'The value of WeakMap.prototype.set.name is "set"' +); + +verifyNotEnumerable(WeakMap.prototype.set, 'name'); +verifyNotWritable(WeakMap.prototype.set, 'name'); +verifyConfigurable(WeakMap.prototype.set, 'name'); diff --git a/test/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.js b/test/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.js new file mode 100644 index 0000000000000000000000000000000000000000..b7221250469dd1a3178c2fca14cd2977969a24a4 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/returns-this-when-ignoring-duplicate.js @@ -0,0 +1,22 @@ +// 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.5 +description: Returns `this` when new value is duplicate. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + ... + 6. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, then + i. Set p.[[value]] to value. + ii. Return M. + ... +---*/ + +var foo = {}; +var map = new WeakMap([[foo, 1]]); + +assert.sameValue(map.set(foo, 1), map, '`map.set(foo, 1)` returns `map`'); diff --git a/test/built-ins/WeakMap/prototype/set/returns-this.js b/test/built-ins/WeakMap/prototype/set/returns-this.js new file mode 100644 index 0000000000000000000000000000000000000000..d92c5fc801973e92ea9d5b76ccf8315f54f62a73 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/returns-this.js @@ -0,0 +1,17 @@ +// 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.5 +description: Returns `this` after setting a new value. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be this value. + ... + 9. Return M. + +---*/ + +var map = new WeakMap(); + +assert.sameValue(map.set({}, 1), map, '`map.set({}, 1)` returns `map`'); diff --git a/test/built-ins/WeakMap/prototype/set/set.js b/test/built-ins/WeakMap/prototype/set/set.js new file mode 100644 index 0000000000000000000000000000000000000000..173b3e0ebf122f36291dc7ad2eeb9a3f70a9cc97 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/set.js @@ -0,0 +1,22 @@ +// 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.5 +description: WeakMap.prototype.set property descriptor +info: > + WeakMap.prototype.set ( key, value ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + typeof WeakMap.prototype.set, + 'function', + 'typeof WeakMap.prototype.set is "function"' +); + +verifyNotEnumerable(WeakMap.prototype, 'set'); +verifyWritable(WeakMap.prototype, 'set'); +verifyConfigurable(WeakMap.prototype, 'set'); diff --git a/test/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.js b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.js new file mode 100644 index 0000000000000000000000000000000000000000..e36b6201e7e577f075486027e0078786fab53fe3 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-boolean.js @@ -0,0 +1,20 @@ +// 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.5 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(false, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(false, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/this-not-object-throw-null.js b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-null.js new file mode 100644 index 0000000000000000000000000000000000000000..dba5205606adf3df32d4ce8925559b4980d00d9a --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-null.js @@ -0,0 +1,20 @@ +// 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.5 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(null, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(null, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/this-not-object-throw-number.js b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-number.js new file mode 100644 index 0000000000000000000000000000000000000000..e4745ca50e50b3367cbacc425c67e34ace8618e6 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-number.js @@ -0,0 +1,20 @@ +// 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.5 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(0, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(0, {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/this-not-object-throw-string.js b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-string.js new file mode 100644 index 0000000000000000000000000000000000000000..8764b24258ac6c9537809f440d9c1c1195ccea11 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-string.js @@ -0,0 +1,20 @@ +// 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.5 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call('', {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call('', {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.js b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.js new file mode 100644 index 0000000000000000000000000000000000000000..c7f1cfe453808cd90da21bb80befd148bb79006f --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-symbol.js @@ -0,0 +1,21 @@ +// 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.5 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(Symbol(), {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(Symbol(), {}, 1); +}); diff --git a/test/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.js b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..4c8d0fdfff9cbbb6fe59f0d7260fd29de3028c98 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/set/this-not-object-throw-undefined.js @@ -0,0 +1,20 @@ +// 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.5 +description: Throws TypeError if `this` is not Object. +info: > + WeakMap.prototype.set ( key, value ) + + 1. Let M be the this value. + 2. If Type(M) is not Object, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap.prototype.set.call(undefined, {}, 1); +}); + +assert.throws(TypeError, function() { + var map = new WeakMap(); + map.set.call(undefined, {}, 1); +}); diff --git a/test/built-ins/WeakMap/set-not-callable-throws.js b/test/built-ins/WeakMap/set-not-callable-throws.js new file mode 100644 index 0000000000000000000000000000000000000000..db6c76586a1d5f52a5fea4752e2854901a89fed9 --- /dev/null +++ b/test/built-ins/WeakMap/set-not-callable-throws.js @@ -0,0 +1,25 @@ +// 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.1.1 +description: > + Throws TypeError if add is not callable on constructor call. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + ... + 5. If iterable is not present, let iterable be undefined. + 6. If iterable is either undefined or null, let iter be undefined. + 7. Else, + a. Let adder be Get(map, "set"). + b. ReturnIfAbrupt(adder). + c. If IsCallable(adder) is false, throw a TypeError exception. + ... +---*/ + +WeakMap.prototype.set = null; +new WeakMap(); + +assert.throws(TypeError, function() { + new WeakMap([]); +}); diff --git a/test/built-ins/WeakMap/symbol-disallowed-as-weakmap-key.js b/test/built-ins/WeakMap/symbol-disallowed-as-weakmap-key.js deleted file mode 100644 index 4ed39dfe5a8f8a174db8575013ab7ac2b199af4a..0000000000000000000000000000000000000000 --- a/test/built-ins/WeakMap/symbol-disallowed-as-weakmap-key.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) Copyright 2013 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 23.3.3.5_S2 -description: > - Symbol may not be used as a WeakMap key -features: [WeakMap] ----*/ -var weakmap = new WeakMap(); -var sym = Symbol(); - -assert.throws(TypeError, function() { - weakmap.set(sym, 1); -}); diff --git a/test/built-ins/WeakMap/undefined-newtarget.js b/test/built-ins/WeakMap/undefined-newtarget.js new file mode 100644 index 0000000000000000000000000000000000000000..d7b5b1bd135359d4fe31f24564788c2527a9d135 --- /dev/null +++ b/test/built-ins/WeakMap/undefined-newtarget.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: 23.3.1.1 +description: > + Throws a TypeError if NewTarget is undefined. +info: > + 23.3.1.1 WeakMap ( [ iterable ] ) + + 1. If NewTarget is undefined, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + WeakMap(); +}); + +assert.throws(TypeError, function() { + WeakMap([]); +}); diff --git a/test/built-ins/WeakMap/weakmap.js b/test/built-ins/WeakMap/weakmap.js new file mode 100644 index 0000000000000000000000000000000000000000..6a67915180025b0d2d92c93a261ad6280f6cdf69 --- /dev/null +++ b/test/built-ins/WeakMap/weakmap.js @@ -0,0 +1,14 @@ +// 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.1.1 +description: > + WeakMap ( [ iterable ] ) + + 17 ECMAScript Standard Built-in Objects +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(this, 'WeakMap'); +verifyWritable(this, 'WeakMap'); +verifyConfigurable(this, 'WeakMap');