You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func test_throttleFirstImmediateFire(){letexp=expectation(description:"Run twice and call immediately")varvalue=0letextractedExpr=Throttler(time:.milliseconds(500), immediateFire: true,{
value +=1})self.throttle = extractedExpr
self.throttle?.call()self.throttle?.call()self.throttle?.call()self.throttle?.call()self.throttle?.call()DispatchQueue.main.asyncAfter(deadline:.now()+.seconds(1)){
if value ==2{
exp.fulfill()}else{XCTAssert(value ==2,"Failed to throttle, calls were not ignored.")}}self.wait(for:[exp], timeout:1)}
expect value == 2, first time and second time after 500ms.
but, this test case failed,
I guess queue.asyncAfter(deadline: dispatchTime, execute: callbackJob) was cancel by second call()
The text was updated successfully, but these errors were encountered:
for such testcase
expect value == 2, first time and second time after 500ms.
but, this test case failed,
I guess
queue.asyncAfter(deadline: dispatchTime, execute: callbackJob)
was cancel by secondcall()
The text was updated successfully, but these errors were encountered: