Skip to content

Commit 8fe6a63

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 003a5ed commit 8fe6a63

1 file changed

Lines changed: 25 additions & 38 deletions

File tree

src/darwin/Framework/CHIPTests/MTRPairingTests.m

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ - (void)test021_CommissioningOperationStopAfterPASEDoesNotFireWatchdog
13571357
// to fire and double-notify -- it must NOT.
13581358
XCTestExpectation * watchdogShouldNotFire = [self expectationWithDescription:@"Watchdog must not fire after stop"];
13591359
watchdogShouldNotFire.inverted = YES;
1360-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), callbackQueue, ^{
1360+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (0.5 * NSEC_PER_SEC)), callbackQueue, ^{
13611361
// If the watchdog had fired, stopExpectation would already have
13621362
// tripped its over-fulfill check. Keep this inverted expectation
13631363
// unsatisfied so we time it out cleanly.
@@ -2586,10 +2586,10 @@ - (void)test036_StopWithArmedWatchdogAndDeadControllerStillCancelsWatchdog
25862586
// that the slot was indeed cleared by -stop and not still live.
25872587
XCTestExpectation * waitForNoFire = [self expectationWithDescription:@"brief wait for spurious fire"];
25882588
waitForNoFire.inverted = YES;
2589-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), callbackQueue, ^{
2590-
// No-op block; the inverted expectation times out cleanly if
2591-
// nothing fires.
2592-
});
2589+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (0.3 * NSEC_PER_SEC)), callbackQueue, ^ {
2590+
// No-op block; the inverted expectation times out cleanly if
2591+
// nothing fires.
2592+
});
25932593
[self waitForExpectations:@[ waitForNoFire ] timeout:0.5];
25942594

25952595
XCTAssertEqual(delegate.failureCallCount, 0u,
@@ -2863,13 +2863,13 @@ - (void)test039_PostPASEWatchdogIsOneShotAndDoesNotAutoRearmAfterFire
28632863
// cancel correct even if it raced with a pending fire.
28642864
XCTestExpectation * noSecondFire = [self expectationWithDescription:@"watchdog must not auto-rearm"];
28652865
noSecondFire.inverted = YES;
2866-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), callbackQueue, ^{
2867-
// No-op; if the dispatch_source spuriously re-fires, the failure
2868-
// callback would land on the (already-nilled) delegate, but the
2869-
// failure count would still increment -- which we check below.
2870-
// The inverted expectation here just gives the dispatch system
2871-
// time to deliver any latent timer event before we read the count.
2872-
});
2866+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (0.5 * NSEC_PER_SEC)), callbackQueue, ^ {
2867+
// No-op; if the dispatch_source spuriously re-fires, the failure
2868+
// callback would land on the (already-nilled) delegate, but the
2869+
// failure count would still increment -- which we check below.
2870+
// The inverted expectation here just gives the dispatch system
2871+
// time to deliver any latent timer event before we read the count.
2872+
});
28732873
[self waitForExpectations:@[ noSecondFire ] timeout:0.7];
28742874

28752875
XCTAssertEqual(delegate.failureCallCount, 1u,
@@ -3267,14 +3267,12 @@ - (void)test043_LateFireGuardSuppressesWatchdogAfterClientAdvancePastPASE
32673267
commissioning.isWaitingAfterPASEEstablished = YES;
32683268

32693269
// Flush the setter's self-bounce.
3270-
dispatch_sync(callbackQueue, ^{
3271-
});
3270+
dispatch_sync(callbackQueue, ^ {});
32723271
XCTAssertTrue(commissioning.isWaitingAfterPASEEstablished);
32733272

32743273
// Client advances: setter -> NO triggers _cancelPostPASEWatchdog.
32753274
commissioning.isWaitingAfterPASEEstablished = NO;
3276-
dispatch_sync(callbackQueue, ^{
3277-
});
3275+
dispatch_sync(callbackQueue, ^ {});
32783276
XCTAssertFalse(commissioning.isWaitingAfterPASEEstablished);
32793277

32803278
// Now an in-flight late timer block (had it been posted to the
@@ -3325,8 +3323,7 @@ - (void)test044_ArmAndIsWaitingAreSerializedOnDelegateQueue
33253323

33263324
// Off-queue setter call must self-bounce; flush by syncing the queue.
33273325
commissioning.isWaitingAfterPASEEstablished = YES;
3328-
dispatch_sync(callbackQueue, ^{
3329-
});
3326+
dispatch_sync(callbackQueue, ^ {});
33303327
XCTAssertTrue(commissioning.isWaitingAfterPASEEstablished,
33313328
@"setter must take effect after self-bounce drained");
33323329

@@ -3336,11 +3333,9 @@ - (void)test044_ArmAndIsWaitingAreSerializedOnDelegateQueue
33363333
// produces a single live source (no leaks) -- exercised structurally
33373334
// by ensuring no exceptions/asserts trip.
33383335
commissioning.isWaitingAfterPASEEstablished = YES;
3339-
dispatch_sync(callbackQueue, ^{
3340-
});
3336+
dispatch_sync(callbackQueue, ^ {});
33413337
commissioning.isWaitingAfterPASEEstablished = NO;
3342-
dispatch_sync(callbackQueue, ^{
3343-
});
3338+
dispatch_sync(callbackQueue, ^ {});
33443339
XCTAssertFalse(commissioning.isWaitingAfterPASEEstablished);
33453340
}
33463341

@@ -3378,17 +3373,15 @@ - (void)test045_FirePostPASEWatchdogStopsCommissioningOnNonInternalPath
33783373
[commissioning _armPostPASEWatchdog];
33793374
});
33803375
commissioning.isWaitingAfterPASEEstablished = YES;
3381-
dispatch_sync(callbackQueue, ^{
3382-
});
3376+
dispatch_sync(callbackQueue, ^ {});
33833377

33843378
dispatch_sync(callbackQueue, ^{
33853379
[commissioning _firePostPASEWatchdog];
33863380
});
33873381

33883382
// Drain the delegate-queue dispatch_async that _dispatchCommissioningError
33893383
// posts to deliver the failure callback.
3390-
dispatch_sync(callbackQueue, ^{
3391-
});
3384+
dispatch_sync(callbackQueue, ^ {});
33923385

33933386
// Even with a nil _controller (no live MTRDeviceController_Concrete
33943387
// attached), _firePostPASEWatchdog must still route the timeout
@@ -3449,8 +3442,7 @@ - (void)test_WatchdogCancelledOnCommissionNodeWithID
34493442
XCTAssertTrue([commissioning _armPostPASEWatchdog]);
34503443
});
34513444
commissioning.isWaitingAfterPASEEstablished = YES;
3452-
dispatch_sync(callbackQueue, ^{
3453-
});
3445+
dispatch_sync(callbackQueue, ^ {});
34543446

34553447
// 500ms after PASE-complete, the delegate calls commissionNodeWithID:
34563448
// (in production this is what the client app does to advance the
@@ -3510,8 +3502,7 @@ - (void)test_WatchdogCancelledOnCancelCommissioning
35103502
XCTAssertTrue([commissioning _armPostPASEWatchdog]);
35113503
});
35123504
commissioning.isWaitingAfterPASEEstablished = YES;
3513-
dispatch_sync(callbackQueue, ^{
3514-
});
3505+
dispatch_sync(callbackQueue, ^ {});
35153506

35163507
// From paseSessionEstablishmentComplete: -- which on a real
35173508
// controller would mean "client decided to bail" -- simulate the
@@ -3596,8 +3587,7 @@ - (void)test_WatchdogCancelledOnControllerInvalidate
35963587
XCTAssertTrue([commissioning _armPostPASEWatchdog]);
35973588
});
35983589
commissioning.isWaitingAfterPASEEstablished = YES;
3599-
dispatch_sync(callbackQueue, ^{
3600-
});
3590+
dispatch_sync(callbackQueue, ^ {});
36013591
XCTAssertTrue(commissioning.isWaitingAfterPASEEstablished);
36023592

36033593
// "Invalidate" the controller -- structurally, drop the
@@ -3674,8 +3664,7 @@ - (void)test_WatchdogIdempotentArm
36743664
// Enter the post-PASE waiting state so the late-fire guard inside
36753665
// the timer's event_handler does not suppress the production fire.
36763666
commissioning.isWaitingAfterPASEEstablished = YES;
3677-
dispatch_sync(callbackQueue, ^{
3678-
});
3667+
dispatch_sync(callbackQueue, ^ {});
36793668

36803669
// Let the single armed source fire naturally (~2s). If the second
36813670
// arm had silently leaked a second source, both would fire here
@@ -3887,8 +3876,7 @@ - (void)test_WatchdogDoesNotFire_OnNormalFlow
38873876
// protects us from a late-fire after success. If isWaitingAfterPASEEstablished
38883877
// were left stuck at YES, the late-fire guard inside the dispatch
38893878
// event_handler would not suppress a leaked timer's fire.
3890-
dispatch_sync(callbackQueue, ^{
3891-
});
3879+
dispatch_sync(callbackQueue, ^ {});
38923880
XCTAssertFalse(commissioning.isWaitingAfterPASEEstablished,
38933881
@"after successful commissionNodeWithID:, isWaitingAfterPASEEstablished must be NO and the watchdog must be torn down");
38943882

@@ -4036,8 +4024,7 @@ - (void)test_WatchdogArmFailure_FaultInjectionIsOneShot
40364024
// by the time we observe the arm-call results below, the flag write
40374025
// has already been seen.
40384026
[commissioning setForceNextArmFailureForTesting:YES];
4039-
dispatch_sync(callbackQueue, ^{
4040-
});
4027+
dispatch_sync(callbackQueue, ^ {});
40414028

40424029
// First arm: must observe the injected failure and clear the flag.
40434030
__block BOOL firstArm = YES;

0 commit comments

Comments
 (0)