From 9285dd3b666997e8aa9f66d4a303403fc6f22db1 Mon Sep 17 00:00:00 2001 From: Devin Ivy Date: Thu, 23 Apr 2026 13:38:56 -0400 Subject: [PATCH] test(shared): exercise dispose behaviorally in RwLock.tryReadLock test --- test/shared/rwlock.test.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/shared/rwlock.test.ts b/test/shared/rwlock.test.ts index 861c83f..b1e3b9b 100644 --- a/test/shared/rwlock.test.ts +++ b/test/shared/rwlock.test.ts @@ -119,16 +119,15 @@ describe('RwLock', () => { assert.deepEqual(results.sort(), ['r1', 'r2']); }); - it('tryReadLock returns a guard when unlocked', () => { + it('tryReadLock returns a guard when unlocked', async () => { const rw = rwlock(); const guard = rw.tryReadLock(); assert.ok(guard); assert.equal(typeof guard[Symbol.dispose], 'function'); guard[Symbol.dispose](); - // Should be able to read-lock again after dispose - const guard2 = rw.tryReadLock(); - assert.ok(guard2); - rw.readUnlock(); + // writeLock only succeeds if readUnlock was called (reader count back to 0) + await rw.writeLock(); + rw.writeUnlock(); }); it('multiple concurrent tryReadLock calls all succeed', () => { -- 2.51.2