Skip to content

Commit 5f9352c

Browse files
committed
Fixed indentation.
1 parent b6d36fa commit 5f9352c

File tree

2 files changed

+63
-65
lines changed

2 files changed

+63
-65
lines changed

stdlib/public/SDK/XCTest/XCTest.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,18 +1037,18 @@ public func XCTAssertNoThrow<T>(_ expression: @autoclosure () throws -> T, _ mes
10371037

10381038
switch result {
10391039
case .success:
1040-
guard let error = error else {
1041-
return
1042-
}
1040+
guard let error = error else {
1041+
return
1042+
}
10431043

10441044
case .failedWithError(let error):
1045-
_XCTRegisterFailure(true, "XCTAssertNoThrow failed: threw error \"\(error)\"", message, file, line)
1045+
_XCTRegisterFailure(true, "XCTAssertNoThrow failed: threw error \"\(error)\"", message, file, line)
10461046

10471047
case .failedWithException(_, _, let reason):
1048-
_XCTRegisterFailure(true, _XCTFailureDescription(assertionType, 1, reason as NSString), message, file, line)
1048+
_XCTRegisterFailure(true, _XCTFailureDescription(assertionType, 1, reason as NSString), message, file, line)
10491049

10501050
case .failedWithUnknownException:
1051-
_XCTRegisterFailure(true, _XCTFailureDescription(assertionType, 2), message, file, line)
1051+
_XCTRegisterFailure(true, _XCTFailureDescription(assertionType, 2), message, file, line)
10521052
}
10531053
}
10541054

validation-test/stdlib/XCTest.swift

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -253,79 +253,77 @@ XCTestTestSuite.test("XCTAssertThrowsError") {
253253
}
254254

255255
XCTestTestSuite.test("XCTAssertNoThrow") {
256-
class ErrorTestCase: XCTestCase {
257-
var doThrow = true
258-
var errorCode = 42
259-
260-
dynamic func throwSomething() throws {
261-
if doThrow {
262-
throw NSError(domain: "MyDomain", code: errorCode, userInfo: nil)
263-
}
264-
}
265-
266-
dynamic func test_throws() {
267-
268-
XCTAssertNoThrow(try throwSomething()) {
269-
error in
270-
let nserror = error as NSError
271-
XCTAssertEqual(nserror.domain, "MyDomain")
272-
XCTAssertEqual(nserror.code, 42)
273-
}
274-
}
275-
}
276-
277-
// Success
278-
do {
279-
let testCase = ErrorTestCase(selector: #selector(ErrorTestCase.test_throws))
280-
testCase.doThrow = false
281-
execute(testCase.run)
282-
let testRun = testCase.testRun!
256+
class ErrorTestCase: XCTestCase {
257+
var doThrow = true
258+
var errorCode = 42
283259

284-
expectEqual(1, testRun.testCaseCount)
285-
expectEqual(1, testRun.executionCount)
286-
expectEqual(0, testRun.failureCount)
287-
expectEqual(0, testRun.unexpectedExceptionCount)
288-
expectEqual(0, testRun.totalFailureCount)
289-
expectTrue(testRun.hasSucceeded)
260+
dynamic func throwSomething() throws {
261+
if doThrow {
262+
throw NSError(domain: "MyDomain", code: errorCode, userInfo: nil)
263+
}
290264
}
291265

292-
// Failure
293-
do {
294-
let testCase = ErrorTestCase(selector: #selector(ErrorTestCase.test_throws))
295-
execute(testCase.run)
296-
let testRun = testCase.testRun!
266+
dynamic func test_throws() {
297267

298-
expectEqual(1, testRun.testCaseCount)
299-
expectEqual(1, testRun.executionCount)
300-
expectEqual(1, testRun.failureCount)
301-
expectEqual(0, testRun.unexpectedExceptionCount)
302-
expectEqual(1, testRun.totalFailureCount)
303-
expectFalse(testRun.hasSucceeded)
268+
XCTAssertNoThrow(try throwSomething()) {
269+
error in
270+
let nserror = error as NSError
271+
XCTAssertEqual(nserror.domain, "MyDomain")
272+
XCTAssertEqual(nserror.code, 42)
273+
}
304274
}
275+
}
305276

306-
// Throws wrong thing
307-
do {
308-
let testCase = ErrorTestCase(selector: #selector(ErrorTestCase.test_throws))
309-
testCase.errorCode = 23
310-
execute(testCase.run)
311-
let testRun = testCase.testRun!
277+
// Success
278+
do {
279+
let testCase = ErrorTestCase(selector: #selector(ErrorTestCase.test_throws))
280+
testCase.doThrow = false
281+
execute(testCase.run)
282+
let testRun = testCase.testRun!
283+
284+
expectEqual(1, testRun.testCaseCount)
285+
expectEqual(1, testRun.executionCount)
286+
expectEqual(0, testRun.failureCount)
287+
expectEqual(0, testRun.unexpectedExceptionCount)
288+
expectEqual(0, testRun.totalFailureCount)
289+
expectTrue(testRun.hasSucceeded)
290+
}
312291

313-
expectEqual(1, testRun.testCaseCount)
314-
expectEqual(1, testRun.executionCount)
315-
expectEqual(1, testRun.failureCount)
316-
expectEqual(0, testRun.unexpectedExceptionCount)
317-
expectEqual(1, testRun.totalFailureCount)
318-
expectFalse(testRun.hasSucceeded)
319-
}
292+
// Failure
293+
do {
294+
let testCase = ErrorTestCase(selector: #selector(ErrorTestCase.test_throws))
295+
execute(testCase.run)
296+
let testRun = testCase.testRun!
297+
298+
expectEqual(1, testRun.testCaseCount)
299+
expectEqual(1, testRun.executionCount)
300+
expectEqual(1, testRun.failureCount)
301+
expectEqual(0, testRun.unexpectedExceptionCount)
302+
expectEqual(1, testRun.totalFailureCount)
303+
expectFalse(testRun.hasSucceeded)
304+
}
320305

306+
// Throws wrong thing
307+
do {
308+
let testCase = ErrorTestCase(selector: #selector(ErrorTestCase.test_throws))
309+
testCase.errorCode = 23
310+
execute(testCase.run)
311+
let testRun = testCase.testRun!
312+
313+
expectEqual(1, testRun.testCaseCount)
314+
expectEqual(1, testRun.executionCount)
315+
expectEqual(1, testRun.failureCount)
316+
expectEqual(0, testRun.unexpectedExceptionCount)
317+
expectEqual(1, testRun.totalFailureCount)
318+
expectFalse(testRun.hasSucceeded)
319+
}
321320
}
322321

323-
324322
XCTestTestSuite.test("XCTAsserts with throwing expressions") {
325323
class ErrorTestCase: XCTestCase {
326324
var doThrow = true
327325
var errorCode = 42
328-
326+
329327
dynamic func throwSomething() throws -> String {
330328
if doThrow {
331329
throw NSError(domain: "MyDomain", code: errorCode, userInfo: nil)

0 commit comments

Comments
 (0)