test262/test/staging/set-is-subset-table-transition.js
Rezvan Mahdavi Hezaveh 467a0fe68f [test262] Add staging tests for isSubsetOf set method
This CL adds three tests to staging directory of test262.

Bug: v8:13556
Change-Id: Id6e468a0fa29528350a10c94e9dd19c2835788e8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5055866
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#91139}
2023-11-27 18:49:17 +01:00

30 lines
711 B
JavaScript

// Copyright (C) 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Test isSubsetOf set method after table transition in receiver.
features: [set-methods]
---*/
const firstSet = new Set();
firstSet.add(42);
firstSet.add(43);
firstSet.add(44);
const setLike = {
size: 5,
keys() {
return [1, 2, 3, 4, 5].keys();
},
has(key) {
if (key == 42) {
// Cause a table transition in the receiver.
firstSet.clear();
}
// Return true so we keep iterating the transitioned receiver.
return true;
}
};
assert.sameValue(firstSet.isSubsetOf(setLike), true);
assert.sameValue(firstSet.size, 0);