Skip to content

Commit 2e59aad

Browse files
authored
Move Map.prototype.getOrInsert tests from staging (#4472)
* Move Map.prototype.getOrInsert tests from staging * Fix esid and remove noStrict * Add check for map.get(-0) to append-new-values-normalizes-zero-key.js
1 parent 545df3a commit 2e59aad

14 files changed

+15
-29
lines changed

test/staging/upsert/Map/getOrInsert/append-new-values-normalizes-zero-key.js renamed to test/built-ins/Map/prototype/getOrInsert/append-new-values-normalizes-zero-key.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Append a new value in the map normalizing +0 and -0.
88
info: |
@@ -16,7 +16,6 @@ info: |
1616
6. Append p to M.[[MapData]].
1717
...
1818
features: [Symbol, upsert]
19-
flags: [noStrict]
2019
---*/
2120
var map = new Map();
2221
map.getOrInsert(-0, 42);
@@ -25,4 +24,4 @@ assert.sameValue(map.get(0), 42);
2524
map = new Map();
2625
map.getOrInsert(+0, 43);
2726
assert.sameValue(map.get(0), 43);
28-
27+
assert.sameValue(map.get(-0), 43);

test/staging/upsert/Map/getOrInsert/append-new-values.js renamed to test/built-ins/Map/prototype/getOrInsert/append-new-values.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Append a new value as the last element of entries.
88
info: |
@@ -16,7 +16,6 @@ info: |
1616
6. Append p to M.[[MapData]].
1717
...
1818
features: [Symbol, upsert]
19-
flags: [noStrict]
2019
---*/
2120
var s = Symbol(2);
2221
var map = new Map([[4, 4], ['foo3', 3], [s, 2]]);

test/staging/upsert/Map/getOrInsert/append-value-if-key-is-not-present-different-key-types.js renamed to test/built-ins/Map/prototype/getOrInsert/append-value-if-key-is-not-present-different-key-types.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Inserts the value for the specified key on different types, when key not present.
88
info: |
@@ -13,7 +13,6 @@ info: |
1313
6. Append p to M.[[MapData]].
1414
...
1515
features: [Symbol, upsert]
16-
flags: [noStrict]
1716
---*/
1817
var map = new Map();
1918

test/staging/upsert/Map/getOrInsert/does-not-have-mapdata-internal-slot-set.js renamed to test/built-ins/Map/prototype/getOrInsert/does-not-have-mapdata-internal-slot-set.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Throws a TypeError if `this` is a Set Object
88
info: |
@@ -13,7 +13,6 @@ info: |
1313
2. Perform ? RequireInternalSlot(M, [[MapData]])
1414
...
1515
features: [Set, upsert]
16-
flags: [noStrict]
1716
---*/
1817
assert.throws(TypeError, function () {
1918
Map.prototype.getOrInsert.call(new Set(), 1, 1);

test/staging/upsert/Map/getOrInsert/does-not-have-mapdata-internal-slot-weakmap.js renamed to test/built-ins/Map/prototype/getOrInsert/does-not-have-mapdata-internal-slot-weakmap.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Throws a TypeError if `this` is a WeakMap object.
88
info: |
@@ -13,7 +13,6 @@ info: |
1313
2. Perform ? RequireInternalSlot(M, [[MapData]]).
1414
...
1515
features: [WeakMap, upsert]
16-
flags: [noStrict]
1716
---*/
1817
assert.throws(TypeError, function() {
1918
Map.prototype.getOrInsert.call(new WeakMap(), 1, 1);

test/staging/upsert/Map/getOrInsert/does-not-have-mapdata-internal-slot.js renamed to test/built-ins/Map/prototype/getOrInsert/does-not-have-mapdata-internal-slot.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
88
info: |
@@ -13,7 +13,6 @@ info: |
1313
2. Perform ? RequireInternalSLot(M, [[MapData]])
1414
...
1515
features: [upsert]
16-
flags: [noStrict]
1716
---*/
1817
var map = new Map();
1918

test/staging/upsert/Map/getOrInsert/getOrInsert.js renamed to test/built-ins/Map/prototype/getOrInsert/getOrInsert.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Property type and descriptor.
88
info: |
@@ -11,7 +11,6 @@ info: |
1111
17 ECMAScript Standard Built-in Objects
1212
includes: [propertyHelper.js]
1313
features: [upsert]
14-
flags: [noStrict]
1514
---*/
1615
assert.sameValue(
1716
typeof Map.prototype.getOrInsert,

test/staging/upsert/Map/getOrInsert/length.js renamed to test/built-ins/Map/prototype/getOrInsert/length.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Map.prototype.getOrInsert.length value and descriptor.
88
info: |
@@ -11,7 +11,6 @@ info: |
1111
17 ECMAScript Standard Built-in Objects
1212
includes: [propertyHelper.js]
1313
features: [upsert]
14-
flags: [noStrict]
1514
---*/
1615
verifyProperty(Map.prototype.getOrInsert, "length", {
1716
value: 2,

test/staging/upsert/Map/getOrInsert/name.js renamed to test/built-ins/Map/prototype/getOrInsert/name.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
33
// This code is governed by the BSD license found in the LICENSE file.
44
/*---
5-
esid: proposal-upsert
5+
esid: sec-map.prototype.getorinsert
66
description: |
77
Map.prototype.getOrInsert.name value and descriptor.
88
info: |
@@ -11,7 +11,6 @@ info: |
1111
17 ECMAScript Standard Built-in Objects
1212
includes: [propertyHelper.js]
1313
features: [upsert]
14-
flags: [noStrict]
1514
---*/
1615
verifyProperty(Map.prototype.getOrInsert, "name", {
1716
value: "getOrInsert",

test/staging/upsert/Map/getOrInsert/not-a-constructor.js renamed to test/built-ins/Map/prototype/getOrInsert/not-a-constructor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This code is governed by the BSD license found in the LICENSE file.
44

55
/*---
6-
esid: proposal-upsert
6+
esid: sec-map.prototype.getorinsert
77
description: |
88
Map.prototype.getOrInsert does not implement [[Construct]], is not new-able
99
info: |
@@ -20,7 +20,6 @@ info: |
2020
...
2121
includes: [isConstructor.js]
2222
features: [Map, Reflect.construct, arrow-function, upsert]
23-
flags: [noStrict]
2423
---*/
2524
assert.sameValue(isConstructor(Map.prototype.getOrInsert), false, 'isConstructor(Map.prototype.getOrInsert) must return false');
2625

0 commit comments

Comments
 (0)