Skip to content

Commit b529ef9

Browse files
committed
Fix recursive lock test
1 parent 719613a commit b529ef9

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

Tests/RxSwiftTests/RecursiveLockTest.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,13 @@ extension RecursiveLockTests {
137137
func testLockUnlockCountsResources() {
138138
let lock = RecursiveLock()
139139

140-
let initial = Resources.total
141-
140+
// Test that lock/unlock are balanced by checking the net effect.
141+
let beforeLockUnlock = Resources.total
142142
lock.lock()
143-
144-
XCTAssertEqual((initial + 1) as Int32, Resources.total)
145-
146143
lock.unlock()
144+
let afterLockUnlock = Resources.total
147145

148-
XCTAssertEqual(initial, Resources.total)
146+
XCTAssertEqual(beforeLockUnlock, afterLockUnlock)
149147
}
150148
#endif
151149
}

0 commit comments

Comments
 (0)