mirror of
https://github.com/tc39/test262.git
synced 2025-07-20 04:24:40 +02:00
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
This commit is contained in:
parent
545df3a432
commit
2e59aad8d1
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Append a new value in the map normalizing +0 and -0.
|
||||
info: |
|
||||
@ -16,7 +16,6 @@ info: |
|
||||
6. Append p to M.[[MapData]].
|
||||
...
|
||||
features: [Symbol, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var map = new Map();
|
||||
map.getOrInsert(-0, 42);
|
||||
@ -25,4 +24,4 @@ assert.sameValue(map.get(0), 42);
|
||||
map = new Map();
|
||||
map.getOrInsert(+0, 43);
|
||||
assert.sameValue(map.get(0), 43);
|
||||
|
||||
assert.sameValue(map.get(-0), 43);
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Append a new value as the last element of entries.
|
||||
info: |
|
||||
@ -16,7 +16,6 @@ info: |
|
||||
6. Append p to M.[[MapData]].
|
||||
...
|
||||
features: [Symbol, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var s = Symbol(2);
|
||||
var map = new Map([[4, 4], ['foo3', 3], [s, 2]]);
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Inserts the value for the specified key on different types, when key not present.
|
||||
info: |
|
||||
@ -13,7 +13,6 @@ info: |
|
||||
6. Append p to M.[[MapData]].
|
||||
...
|
||||
features: [Symbol, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var map = new Map();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Throws a TypeError if `this` is a Set Object
|
||||
info: |
|
||||
@ -13,7 +13,6 @@ info: |
|
||||
2. Perform ? RequireInternalSlot(M, [[MapData]])
|
||||
...
|
||||
features: [Set, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
assert.throws(TypeError, function () {
|
||||
Map.prototype.getOrInsert.call(new Set(), 1, 1);
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Throws a TypeError if `this` is a WeakMap object.
|
||||
info: |
|
||||
@ -13,7 +13,6 @@ info: |
|
||||
2. Perform ? RequireInternalSlot(M, [[MapData]]).
|
||||
...
|
||||
features: [WeakMap, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
assert.throws(TypeError, function() {
|
||||
Map.prototype.getOrInsert.call(new WeakMap(), 1, 1);
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Throws a TypeError if `this` object does not have a [[MapData]] internal slot.
|
||||
info: |
|
||||
@ -13,7 +13,6 @@ info: |
|
||||
2. Perform ? RequireInternalSLot(M, [[MapData]])
|
||||
...
|
||||
features: [upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var map = new Map();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Property type and descriptor.
|
||||
info: |
|
||||
@ -11,7 +11,6 @@ info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
includes: [propertyHelper.js]
|
||||
features: [upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
assert.sameValue(
|
||||
typeof Map.prototype.getOrInsert,
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Map.prototype.getOrInsert.length value and descriptor.
|
||||
info: |
|
||||
@ -11,7 +11,6 @@ info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
includes: [propertyHelper.js]
|
||||
features: [upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
verifyProperty(Map.prototype.getOrInsert, "length", {
|
||||
value: 2,
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Map.prototype.getOrInsert.name value and descriptor.
|
||||
info: |
|
||||
@ -11,7 +11,6 @@ info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
includes: [propertyHelper.js]
|
||||
features: [upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
verifyProperty(Map.prototype.getOrInsert, "name", {
|
||||
value: "getOrInsert",
|
@ -3,7 +3,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Map.prototype.getOrInsert does not implement [[Construct]], is not new-able
|
||||
info: |
|
||||
@ -20,7 +20,6 @@ info: |
|
||||
...
|
||||
includes: [isConstructor.js]
|
||||
features: [Map, Reflect.construct, arrow-function, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
assert.sameValue(isConstructor(Map.prototype.getOrInsert), false, 'isConstructor(Map.prototype.getOrInsert) must return false');
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Returns the value from the specified key on different types, when key not present.
|
||||
info: |
|
||||
@ -14,7 +14,6 @@ info: |
|
||||
7. Return p.[[Value]].
|
||||
...
|
||||
features: [Symbol, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var map = new Map();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Returns the value set before getOrInsert from the specified key on different types.
|
||||
info: |
|
||||
@ -13,7 +13,6 @@ info: |
|
||||
a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return p.[[Value]].
|
||||
...
|
||||
features: [Symbol, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var map = new Map();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Jonas Haukenes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Returns the value from the specified key normalizing +0 and -0.
|
||||
info: |
|
||||
@ -13,7 +13,6 @@ info: |
|
||||
a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return p.[[Value]].
|
||||
...
|
||||
features: [upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var map = new Map();
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2024 Sune Eriksson Lianes. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: proposal-upsert
|
||||
esid: sec-map.prototype.getorinsert
|
||||
description: |
|
||||
Throws a TypeError if `this` is not an Object.
|
||||
info: |
|
||||
@ -12,7 +12,6 @@ info: |
|
||||
2. Perform ? RequireInternalSlot(M, [[MapData]])
|
||||
...
|
||||
features: [Symbol, upsert]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
var m = new Map();
|
||||
|
Loading…
x
Reference in New Issue
Block a user