Skip to content

Updates for SE-0110 Part I #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/XCTest/Private/TestFiltering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ internal struct TestFiltering {
}

private func excludeAllFilter() -> TestFilter {
return { _ in false }
return { _, _ in false }
}

private func includeAllFilter() -> TestFilter {
return { _ in true }
return { _, _ in true }
}

static func filterTests(_ entries: [XCTestCaseEntry], filter: TestFilter) -> [XCTestCaseEntry] {
return entries
.map { testCaseClass, testCaseMethods in
return (testCaseClass, testCaseMethods.filter { filter(testCaseClass, $0.0) } )
return (testCaseClass, testCaseMethods.filter { s, _ in filter(testCaseClass, s) } )
}
.filter { _, testCaseMethods in
return !testCaseMethods.isEmpty
Expand Down
4 changes: 2 additions & 2 deletions Sources/XCTest/Public/XCTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ public class XCTestCase: XCTest {
/// the signature required by `XCTMain`
/// - seealso: `XCTMain`
public func testCase<T: XCTestCase>(_ allTests: [(String, (T) -> () throws -> Void)]) -> XCTestCaseEntry {
let tests: [(String, (XCTestCase) throws -> Void)] = allTests.map { ($0.0, test($0.1)) }
let tests: [(String, (XCTestCase) throws -> Void)] = allTests.map { ($0, test($1)) }
return (T.self, tests)
}

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

Expand Down
6 changes: 3 additions & 3 deletions Tests/Functional/Asynchronous/Predicates/Handler/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PredicateHandlerTestCase: XCTestCase {
func test_predicateIsTrue_handlerReturnsTrue_passes() {
let predicate = Predicate(value: true)
let object = NSObject()
self.expectation(for: predicate, evaluatedWith: object, handler: { _ in
self.expectation(for: predicate, evaluatedWith: object, handler: {
return true
})
waitForExpectations(timeout: 0.1)
Expand All @@ -31,7 +31,7 @@ class PredicateHandlerTestCase: XCTestCase {
func test_predicateIsTrue_handlerReturnsFalse_fails() {
let predicate = Predicate(value: true)
let object = NSObject()
self.expectation(for: predicate, evaluatedWith: object, handler: { _ in
self.expectation(for: predicate, evaluatedWith: object, handler: {
return false
})
waitForExpectations(timeout: 0.1)
Expand All @@ -48,7 +48,7 @@ class PredicateHandlerTestCase: XCTestCase {
}
return false
})
expectation(for: predicate, evaluatedWith: halfSecLaterDate, handler: { _ in
expectation(for: predicate, evaluatedWith: halfSecLaterDate, handler: {
XCTFail("Should not call the predicate expectation handler")
return true
})
Expand Down