Skip to content

Commit

Permalink
Merge pull request Carthage#2168 from Carthage/nimble-predicate
Browse files Browse the repository at this point in the history
Use the new `Predicate` type for Nimble matchers
  • Loading branch information
ikesyo authored Sep 22, 2017
2 parents 89a1133 + 1dd41f8 commit a8795b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Tests/CarthageKitTests/ResolverSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private func ==<A: Equatable, B: Equatable>(lhs: [(A, B)], rhs: [(A, B)]) -> Boo
return true
}

private func equal<A: Equatable, B: Equatable>(_ expectedValue: [(A, B)]?) -> NonNilMatcherFunc<[(A, B)]> {
private func equal<A: Equatable, B: Equatable>(_ expectedValue: [(A, B)]?) -> Predicate<[(A, B)]> {
return NonNilMatcherFunc { actualExpression, failureMessage in
failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>"
let actualValue = try actualExpression.evaluate()
Expand All @@ -113,7 +113,7 @@ private func equal<A: Equatable, B: Equatable>(_ expectedValue: [(A, B)]?) -> No
return false
}
return expectedValue! == actualValue!
}
}.predicate
}

private func ==<A: Equatable, B: Equatable>(lhs: Expectation<[(A, B)]>, rhs: [(A, B)]) {
Expand Down
8 changes: 4 additions & 4 deletions Tests/CarthageKitTests/XcodeSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class XcodeSpec: QuickSpec {

// MARK: Matcher

internal func beExistingDirectory() -> MatcherFunc<String> {
internal func beExistingDirectory() -> Predicate<String> {
return MatcherFunc { actualExpression, failureMessage in
failureMessage.postfixMessage = "exist and be a directory"
let actualPath = try actualExpression.evaluate()
Expand All @@ -417,10 +417,10 @@ internal func beExistingDirectory() -> MatcherFunc<String> {
}

return exists && isDirectory.boolValue
}
}.predicate
}

internal func beRelativeSymlinkToDirectory(_ directory: URL) -> MatcherFunc<URL> {
internal func beRelativeSymlinkToDirectory(_ directory: URL) -> Predicate<URL> {
return MatcherFunc { actualExpression, failureMessage in
failureMessage.postfixMessage = "be a relative symlink to \(directory)"
let actualURL = try actualExpression.evaluate()
Expand Down Expand Up @@ -454,5 +454,5 @@ internal func beRelativeSymlinkToDirectory(_ directory: URL) -> MatcherFunc<URL>
}

return urlsEqual
}
}.predicate
}

0 comments on commit a8795b9

Please sign in to comment.