Skip to content

Commit 3801859

Browse files
rpgeeganagetargos
authored andcommitted
test: add tests for hasItems method in FreeList
PR-URL: #27588 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 119a590 commit 3801859

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/parallel/test-freelist.js

+10
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@ assert.strictEqual(flist1.free({ id: 'test5' }), false);
2828
assert.strictEqual(flist1.alloc().id, 'test3');
2929
assert.strictEqual(flist1.alloc().id, 'test2');
3030
assert.strictEqual(flist1.alloc().id, 'test1');
31+
32+
// Check list has elements
33+
const flist2 = new FreeList('flist2', 2, Object);
34+
assert.strictEqual(flist2.hasItems(), false);
35+
36+
flist2.free({ id: 'test1' });
37+
assert.strictEqual(flist2.hasItems(), true);
38+
39+
flist2.alloc();
40+
assert.strictEqual(flist2.hasItems(), false);

0 commit comments

Comments
 (0)