mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
test-js: Add a mark_as_garbage method to force GC to collect that object
This should fix the flaky tests of test-js. It also fixes the tests when running with the -g flag since the values will not be garbage collected too soon.
This commit is contained in:
parent
3373090993
commit
43b17f27a3
Notes:
sideshowbarker
2024-07-18 04:28:04 +09:00
Author: https://github.com/davidot
Commit: 43b17f27a3
Pull-request: https://github.com/SerenityOS/serenity/pull/9878
Reviewed-by: https://github.com/IdanHo ✅
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/trflynn89
6 changed files with 71 additions and 12 deletions
|
@ -3,11 +3,12 @@ test("length is 0", () => {
|
|||
});
|
||||
|
||||
function registerInDifferentScope(registry) {
|
||||
registry.register({}, {});
|
||||
const target = {};
|
||||
registry.register(target, {});
|
||||
return target;
|
||||
}
|
||||
|
||||
// Flaky test, investigate and fix :^)
|
||||
test.skip("basic functionality", () => {
|
||||
test("basic functionality", () => {
|
||||
var registry = new FinalizationRegistry(() => {});
|
||||
|
||||
var count = 0;
|
||||
|
@ -19,7 +20,8 @@ test.skip("basic functionality", () => {
|
|||
|
||||
expect(count).toBe(0);
|
||||
|
||||
registerInDifferentScope(registry);
|
||||
const target = registerInDifferentScope(registry);
|
||||
markAsGarbage("target");
|
||||
gc();
|
||||
|
||||
registry.cleanupSome(increment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue