Skip to content
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
25 changes: 25 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ let package = Package(
products: [
.library(name: "Nimble", targets: ["Nimble"]),
],
dependencies: [
.package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", .exact("1.2.0")),
],
targets: [
.target(
name: "Nimble",
dependencies: []
dependencies: {
#if os(macOS)
return ["CwlPreconditionTesting"]
#else
return []
#endif
}()
),
.testTarget(
name: "NimbleTests",
Expand Down
11 changes: 10 additions & 1 deletion Package@swift-4.2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ let package = Package(
products: [
.library(name: "Nimble", targets: ["Nimble"]),
],
dependencies: [
.package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", .exact("1.2.0")),
],
targets: [
.target(
name: "Nimble",
dependencies: []
dependencies: {
#if os(macOS)
return ["CwlPreconditionTesting"]
#else
return []
#endif
}()
),
.testTarget(
name: "NimbleTests",
Expand Down
10 changes: 5 additions & 5 deletions Sources/Nimble/Matchers/ThrowAssertion.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Foundation

#if canImport(CwlPreconditionTesting)
import CwlPreconditionTesting
#endif

public func throwAssertion() -> Predicate<Void> {
return Predicate { actualExpression in
#if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE
#if arch(x86_64) && canImport(Darwin)
let message = ExpectationMessage.expectedTo("throw an assertion")

var actualError: Error?
Expand Down Expand Up @@ -38,10 +42,6 @@ public func throwAssertion() -> Predicate<Void> {
} else {
return PredicateResult(bool: caughtException != nil, message: message)
}
#elseif SWIFT_PACKAGE
fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." +
" You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" +
" conditional statement")
#else
fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " +
"Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " +
Expand Down
2 changes: 1 addition & 1 deletion Tests/NimbleTests/Matchers/ThrowAssertionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import XCTest
import Nimble

#if canImport(Darwin) && !SWIFT_PACKAGE
#if canImport(Darwin)

private let error: Error = NSError(domain: "test", code: 0, userInfo: nil)

Expand Down