Skip to content

Commit

Permalink
Update allTests signature for the latest Corelibs XCTest version
Browse files Browse the repository at this point in the history
  • Loading branch information
briancroom committed Feb 6, 2016
1 parent 6d50ff4 commit f4d794d
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Sources/Quick/QuickSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class QuickSpec: XCTestCase, XCTestCaseProvider {

public required init() {}

public var allTests : [(String, () -> Void)] {
public var allTests : [(String, () throws -> Void)] {
gatherExamplesIfNeeded()

let examples = World.sharedWorld.examples(self.dynamicType)
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickFocusedTests/FocusedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FunctionalTests_FocusedSpec_Unfocused: QuickSpec {
}

class FocusedTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testOnlyFocusedExamplesAreExecuted", testOnlyFocusedExamplesAreExecuted),
]
Expand Down
9 changes: 7 additions & 2 deletions Sources/QuickTestHelpers/SpecRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ public func qck_runSpecs(specClasses: [QuickSpec.Type]) -> TestRun {
World.sharedWorld.isRunningAdditionalSuites = true

var executionCount: UInt = 0
var hadUnexpectedFailure = false

let fails = gatherFailingExpectations(silently: true) {
for specClass in specClasses {
let spec = specClass.init()
for (_, test) in spec.allTests {
test()
do {
try test()
} catch {
hadUnexpectedFailure = true
}
executionCount += 1
}
}
}

return TestRun(executionCount: executionCount, hasSucceeded: fails.isEmpty)
return TestRun(executionCount: executionCount, hasSucceeded: fails.isEmpty && !hadUnexpectedFailure)
}
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/AfterEachTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FunctionalTests_AfterEachSpec: QuickSpec {
}

class AfterEachTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testAfterEachIsExecutedInTheCorrectOrder", testAfterEachIsExecutedInTheCorrectOrder),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/AfterSuiteTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FunctionalTests_AfterSuite_Spec: QuickSpec {
}

class AfterSuiteTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testAfterSuiteIsNotExecutedBeforeAnyExamples", testAfterSuiteIsNotExecutedBeforeAnyExamples),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/BeforeEachTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FunctionalTests_BeforeEachSpec: QuickSpec {
}

class BeforeEachTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testBeforeEachIsExecutedInTheCorrectOrder", testBeforeEachIsExecutedInTheCorrectOrder),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/BeforeSuiteTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FunctionalTests_BeforeSuite_Spec: QuickSpec {
}

class BeforeSuiteTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testBeforeSuiteIsExecutedBeforeAnyExamples", testBeforeSuiteIsExecutedBeforeAnyExamples),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Configuration_AfterEachSpec: QuickSpec {
}

class Configuration_AfterEachTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted", testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Configuration_BeforeEachSpec: QuickSpec {
}

class Configuration_BeforeEachTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted", testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/DescribeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Quick
#if _runtime(_ObjC)

class DescribeTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testDescribeThrowsIfUsedOutsideOfQuickSpec", testDescribeThrowsIfUsedOutsideOfQuickSpec),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/ItTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class FunctionalTests_ItSpec: QuickSpec {
}

class ItTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testAllExamplesAreExecuted", testAllExamplesAreExecuted),
]
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/FunctionalTests/PendingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FunctionalTests_PendingSpec: QuickSpec {
}

class PendingTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testAnOtherwiseFailingExampleWhenMarkedPendingDoesNotCauseTheSuiteToFail", testAnOtherwiseFailingExampleWhenMarkedPendingDoesNotCauseTheSuiteToFail),
("testBeforeEachOnlyRunForEnabledExamples", testBeforeEachOnlyRunForEnabledExamples),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FunctionalTests_SharedExamples_BeforeEachSpec: QuickSpec {
}

class SharedExamples_BeforeEachTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testBeforeEachOutsideOfSharedExamplesExecutedOnceBeforeEachExample", testBeforeEachOutsideOfSharedExamplesExecutedOnceBeforeEachExample),
("testBeforeEachInSharedExamplesExecutedOnceBeforeEachSharedExample", testBeforeEachInSharedExamplesExecutedOnceBeforeEachSharedExample),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FunctionalTests_SharedExamples_ErrorSpec: QuickSpec {

// Shared examples are defined in QuickTests/Fixtures
class SharedExamplesTests: XCTestCase, XCTestCaseProvider {
var allTests: [(String, () -> Void)] {
var allTests: [(String, () throws -> Void)] {
return [
("testAGroupOfThreeSharedExamplesExecutesThreeExamples", testAGroupOfThreeSharedExamplesExecutesThreeExamples),
("testSharedExamplesWithContextPassContextToExamples", testSharedExamplesWithContextPassContextToExamples),
Expand Down
2 changes: 1 addition & 1 deletion Sources/QuickTests/Helpers/XCTestCaseProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import XCTest
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)

public protocol XCTestCaseProvider {
var allTests : [(String, () -> Void)] { get }
var allTests: [(String, () throws -> Void)] { get }
}

extension XCTestCase {
Expand Down

0 comments on commit f4d794d

Please sign in to comment.