Skip to content

Commit 608956d

Browse files
authored
Merge pull request #149 from dduan/se0110-a
Updates for SE-0110 Part I
2 parents b99f354 + b6c1200 commit 608956d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Sources/XCTest/Private/TestFiltering.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ internal struct TestFiltering {
2828
}
2929

3030
private func excludeAllFilter() -> TestFilter {
31-
return { _ in false }
31+
return { _, _ in false }
3232
}
3333

3434
private func includeAllFilter() -> TestFilter {
35-
return { _ in true }
35+
return { _, _ in true }
3636
}
3737

3838
static func filterTests(_ entries: [XCTestCaseEntry], filter: TestFilter) -> [XCTestCaseEntry] {
3939
return entries
4040
.map { testCaseClass, testCaseMethods in
41-
return (testCaseClass, testCaseMethods.filter { filter(testCaseClass, $0.0) } )
41+
return (testCaseClass, testCaseMethods.filter { s, _ in filter(testCaseClass, s) } )
4242
}
4343
.filter { _, testCaseMethods in
4444
return !testCaseMethods.isEmpty

Sources/XCTest/Public/XCTestCase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ public class XCTestCase: XCTest {
165165
/// the signature required by `XCTMain`
166166
/// - seealso: `XCTMain`
167167
public func testCase<T: XCTestCase>(_ allTests: [(String, (T) -> () throws -> Void)]) -> XCTestCaseEntry {
168-
let tests: [(String, (XCTestCase) throws -> Void)] = allTests.map { ($0.0, test($0.1)) }
168+
let tests: [(String, (XCTestCase) throws -> Void)] = allTests.map { ($0, test($1)) }
169169
return (T.self, tests)
170170
}
171171

172172
/// Wrapper function for the non-throwing variant of tests.
173173
/// - seealso: `XCTMain`
174174
public func testCase<T: XCTestCase>(_ allTests: [(String, (T) -> () -> Void)]) -> XCTestCaseEntry {
175-
let tests: [(String, (XCTestCase) throws -> Void)] = allTests.map { ($0.0, test($0.1)) }
175+
let tests: [(String, (XCTestCase) throws -> Void)] = allTests.map { ($0, test($1)) }
176176
return (T.self, tests)
177177
}
178178

Tests/Functional/Asynchronous/Predicates/Handler/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PredicateHandlerTestCase: XCTestCase {
2020
func test_predicateIsTrue_handlerReturnsTrue_passes() {
2121
let predicate = Predicate(value: true)
2222
let object = NSObject()
23-
self.expectation(for: predicate, evaluatedWith: object, handler: { _ in
23+
self.expectation(for: predicate, evaluatedWith: object, handler: {
2424
return true
2525
})
2626
waitForExpectations(timeout: 0.1)
@@ -31,7 +31,7 @@ class PredicateHandlerTestCase: XCTestCase {
3131
func test_predicateIsTrue_handlerReturnsFalse_fails() {
3232
let predicate = Predicate(value: true)
3333
let object = NSObject()
34-
self.expectation(for: predicate, evaluatedWith: object, handler: { _ in
34+
self.expectation(for: predicate, evaluatedWith: object, handler: {
3535
return false
3636
})
3737
waitForExpectations(timeout: 0.1)
@@ -48,7 +48,7 @@ class PredicateHandlerTestCase: XCTestCase {
4848
}
4949
return false
5050
})
51-
expectation(for: predicate, evaluatedWith: halfSecLaterDate, handler: { _ in
51+
expectation(for: predicate, evaluatedWith: halfSecLaterDate, handler: {
5252
XCTFail("Should not call the predicate expectation handler")
5353
return true
5454
})

0 commit comments

Comments
 (0)