From 735f95adf5a380ab7fcfc64d3ddfddbb7b71f70f Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 22 Sep 2022 17:01:04 -0700 Subject: [PATCH] Add WeakMap and WeakSet features to tests affected by symbols-as-weakmap-keys Originally taken from Rick's draft commit for symbols-as-weakmap-keys tests. --- test/built-ins/WeakMap/iterable.js | 1 + test/built-ins/WeakMap/iterator-items-are-not-object.js | 2 +- .../WeakMap/prototype/delete/delete-entry-initial-iterable.js | 1 + test/built-ins/WeakMap/prototype/delete/delete-entry.js | 1 + .../prototype/delete/returns-false-value-is-not-object.js | 2 +- .../prototype/delete/returns-false-when-delete-is-noop.js | 1 + .../prototype/get/returns-undefined-key-is-not-object.js | 2 +- test/built-ins/WeakMap/prototype/get/returns-undefined.js | 1 + test/built-ins/WeakMap/prototype/get/returns-value.js | 1 + .../prototype/has/returns-false-when-value-is-not-object.js | 2 +- .../prototype/has/returns-false-when-value-not-present.js | 2 +- .../WeakMap/prototype/has/returns-true-when-value-present.js | 1 + test/built-ins/WeakMap/prototype/set/adds-element.js | 1 + test/built-ins/WeakMap/prototype/set/key-not-object-throw.js | 2 +- test/built-ins/WeakSet/iterable.js | 1 + test/built-ins/WeakSet/prototype/add/adds-element.js | 1 + test/built-ins/WeakSet/prototype/add/value-not-object-throw.js | 2 +- test/built-ins/WeakSet/prototype/delete/delete-entry.js | 2 +- .../prototype/delete/returns-false-value-is-not-object.js | 2 +- .../prototype/has/returns-false-when-value-is-not-object.js | 2 +- .../prototype/has/returns-false-when-value-not-present.js | 2 +- .../WeakSet/prototype/has/returns-true-when-value-present.js | 1 + 22 files changed, 22 insertions(+), 11 deletions(-) diff --git a/test/built-ins/WeakMap/iterable.js b/test/built-ins/WeakMap/iterable.js index 41032ebb53c..3f316f8ae3b 100644 --- a/test/built-ins/WeakMap/iterable.js +++ b/test/built-ins/WeakMap/iterable.js @@ -11,6 +11,7 @@ info: | 9. Repeat k. Let status be Call(adder, map, «k.[[value]], v.[[value]]»). l. If status is an abrupt completion, return IteratorClose(iter, status). +features: [WeakMap] ---*/ var first = {}; diff --git a/test/built-ins/WeakMap/iterator-items-are-not-object.js b/test/built-ins/WeakMap/iterator-items-are-not-object.js index 631d507fff4..fe54b88a48a 100644 --- a/test/built-ins/WeakMap/iterator-items-are-not-object.js +++ b/test/built-ins/WeakMap/iterator-items-are-not-object.js @@ -16,7 +16,7 @@ info: | i. Let error be Completion{[[type]]: throw, [[value]]: a newly created TypeError object, [[target]]:empty}. ii. Return IteratorClose(iter, error). -features: [Symbol] +features: [Symbol, WeakMap] ---*/ assert.throws(TypeError, function() { 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 index de3e6046088..7d3096e2ea5 100644 --- a/test/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js +++ b/test/built-ins/WeakMap/prototype/delete/delete-entry-initial-iterable.js @@ -18,6 +18,7 @@ info: | ii. Set p.[[value]] to empty. iii. Return true. ... +features: [WeakMap] ---*/ var foo = {}; diff --git a/test/built-ins/WeakMap/prototype/delete/delete-entry.js b/test/built-ins/WeakMap/prototype/delete/delete-entry.js index c33c6445912..022c435aff3 100644 --- a/test/built-ins/WeakMap/prototype/delete/delete-entry.js +++ b/test/built-ins/WeakMap/prototype/delete/delete-entry.js @@ -18,6 +18,7 @@ info: | ii. Set p.[[value]] to empty. iii. Return true. ... +features: [WeakMap] ---*/ var foo = {}; 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 index cb0e97466bc..cf060d72da7 100644 --- 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 @@ -8,7 +8,7 @@ info: | WeakMap.prototype.delete ( value ) 5. If Type(key) is not Object, return false. -features: [Symbol] +features: [Symbol, WeakMap] ---*/ var map = new WeakMap(); 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 index 907fb651f70..adb9c949718 100644 --- 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 @@ -10,6 +10,7 @@ info: | ... 7. Return false. +features: [WeakMap] ---*/ var map = new WeakMap(); 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 index 23ad9eb87de..95c1f20d1fe 100644 --- 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 @@ -12,7 +12,7 @@ info: | slot. 5. If Type(key) is not Object, return undefined. ... -features: [Symbol] +features: [Symbol, WeakMap] ---*/ var map = new WeakMap(); diff --git a/test/built-ins/WeakMap/prototype/get/returns-undefined.js b/test/built-ins/WeakMap/prototype/get/returns-undefined.js index cad1c52fe14..0723ccda817 100644 --- a/test/built-ins/WeakMap/prototype/get/returns-undefined.js +++ b/test/built-ins/WeakMap/prototype/get/returns-undefined.js @@ -16,6 +16,7 @@ info: | p.[[value]]. 7. Return undefined. ... +features: [WeakMap] ---*/ var map = new WeakMap(); diff --git a/test/built-ins/WeakMap/prototype/get/returns-value.js b/test/built-ins/WeakMap/prototype/get/returns-value.js index 2a786a0ce17..3c4f160ad18 100644 --- a/test/built-ins/WeakMap/prototype/get/returns-value.js +++ b/test/built-ins/WeakMap/prototype/get/returns-value.js @@ -15,6 +15,7 @@ info: | a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return p.[[value]]. ... +features: [WeakMap] ---*/ var foo = {}; 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 index bd8eccb4053..c3a04a9ae3b 100644 --- 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 @@ -8,7 +8,7 @@ info: | WeakMap.prototype.has ( value ) 5. If Type(key) is not Object, return false. -features: [Symbol] +features: [Symbol, WeakMap] ---*/ var map = new WeakMap(); 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 index 76bbf40e693..6698f3884a5 100644 --- 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 @@ -9,7 +9,7 @@ info: | ... 7. Return false. - +features: [WeakMap] ---*/ var foo = {}; 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 index 5068f21f5eb..bdc01de69ce 100644 --- 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 @@ -13,6 +13,7 @@ info: | a. If p.[[key]] is not empty and SameValue(p.[[key]], key) is true, return true. ... +features: [WeakMap] ---*/ var foo = {}; diff --git a/test/built-ins/WeakMap/prototype/set/adds-element.js b/test/built-ins/WeakMap/prototype/set/adds-element.js index f3ad9a65b5c..4c2d382c48f 100644 --- a/test/built-ins/WeakMap/prototype/set/adds-element.js +++ b/test/built-ins/WeakMap/prototype/set/adds-element.js @@ -11,6 +11,7 @@ info: | 7. Let p be the Record {[[key]]: key, [[value]]: value}. 8. Append p as the last element of entries. ... +features: [WeakMap] ---*/ var map = new WeakMap(); 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 index 2da994c1ed7..f4012e0e9e6 100644 --- a/test/built-ins/WeakMap/prototype/set/key-not-object-throw.js +++ b/test/built-ins/WeakMap/prototype/set/key-not-object-throw.js @@ -7,7 +7,7 @@ info: | WeakMap.prototype.set ( key, value ) 5. If Type(key) is not Object, throw a TypeError exception. -features: [Symbol] +features: [Symbol, WeakMap] ---*/ var s = new WeakMap(); diff --git a/test/built-ins/WeakSet/iterable.js b/test/built-ins/WeakSet/iterable.js index 3de9b3a11c2..51b01175078 100644 --- a/test/built-ins/WeakSet/iterable.js +++ b/test/built-ins/WeakSet/iterable.js @@ -11,6 +11,7 @@ info: | 9. Repeat f. Let status be Call(adder, set, «nextValue»). g. If status is an abrupt completion, return IteratorClose(iter, status). +features: [WeakSet] ---*/ var first = {}; diff --git a/test/built-ins/WeakSet/prototype/add/adds-element.js b/test/built-ins/WeakSet/prototype/add/adds-element.js index b91f1bd30ed..cb9e71a1e33 100644 --- a/test/built-ins/WeakSet/prototype/add/adds-element.js +++ b/test/built-ins/WeakSet/prototype/add/adds-element.js @@ -10,6 +10,7 @@ info: | ... 7. Append value as the last element of entries. ... +features: [WeakSet] ---*/ var s = new WeakSet(); diff --git a/test/built-ins/WeakSet/prototype/add/value-not-object-throw.js b/test/built-ins/WeakSet/prototype/add/value-not-object-throw.js index e5766ad63e3..335e0c40b5e 100644 --- a/test/built-ins/WeakSet/prototype/add/value-not-object-throw.js +++ b/test/built-ins/WeakSet/prototype/add/value-not-object-throw.js @@ -7,7 +7,7 @@ info: | WeakSet.prototype.add ( value ) 4. If Type(value) is not Object, throw a TypeError exception. -features: [Symbol] +features: [Symbol, WeakSet] ---*/ var s = new WeakSet(); diff --git a/test/built-ins/WeakSet/prototype/delete/delete-entry.js b/test/built-ins/WeakSet/prototype/delete/delete-entry.js index 891811324e3..26556749277 100644 --- a/test/built-ins/WeakSet/prototype/delete/delete-entry.js +++ b/test/built-ins/WeakSet/prototype/delete/delete-entry.js @@ -16,7 +16,7 @@ info: | value is empty. ii. Return true. ... - +features: [WeakSet] ---*/ var foo = {}; diff --git a/test/built-ins/WeakSet/prototype/delete/returns-false-value-is-not-object.js b/test/built-ins/WeakSet/prototype/delete/returns-false-value-is-not-object.js index c9b24d94cc3..738d83343b6 100644 --- a/test/built-ins/WeakSet/prototype/delete/returns-false-value-is-not-object.js +++ b/test/built-ins/WeakSet/prototype/delete/returns-false-value-is-not-object.js @@ -8,7 +8,7 @@ info: | WeakSet.prototype.delete ( value ) 4. If Type(value) is not Object, return false. -features: [Symbol] +features: [Symbol, WeakSet] ---*/ var s = new WeakSet(); diff --git a/test/built-ins/WeakSet/prototype/has/returns-false-when-value-is-not-object.js b/test/built-ins/WeakSet/prototype/has/returns-false-when-value-is-not-object.js index 8d29b0aa2c7..9eb2fccff7f 100644 --- a/test/built-ins/WeakSet/prototype/has/returns-false-when-value-is-not-object.js +++ b/test/built-ins/WeakSet/prototype/has/returns-false-when-value-is-not-object.js @@ -8,7 +8,7 @@ info: | WeakSet.prototype.has ( value ) 5. If Type(value) is not Object, return false. -features: [Symbol] +features: [Symbol, WeakSet] ---*/ var s = new WeakSet(); diff --git a/test/built-ins/WeakSet/prototype/has/returns-false-when-value-not-present.js b/test/built-ins/WeakSet/prototype/has/returns-false-when-value-not-present.js index 84cffa530c4..7748e5e7c38 100644 --- a/test/built-ins/WeakSet/prototype/has/returns-false-when-value-not-present.js +++ b/test/built-ins/WeakSet/prototype/has/returns-false-when-value-not-present.js @@ -9,7 +9,7 @@ info: | ... 7. Return false. - +features: [WeakSet] ---*/ var foo = {}; diff --git a/test/built-ins/WeakSet/prototype/has/returns-true-when-value-present.js b/test/built-ins/WeakSet/prototype/has/returns-true-when-value-present.js index e76576bd442..12faddcdac0 100644 --- a/test/built-ins/WeakSet/prototype/has/returns-true-when-value-present.js +++ b/test/built-ins/WeakSet/prototype/has/returns-true-when-value-present.js @@ -11,6 +11,7 @@ info: | 6. Repeat for each e that is an element of entries, a. If e is not empty and SameValue(e, value) is true, return true. ... +features: [WeakSet] ---*/ var foo = {};