Fix description texts from last commit.
This commit is contained in:
parent
c72e91b311
commit
598be22967
|
@ -18,7 +18,7 @@ private func describeCallMismatch(calls: [StubCall], description: Description) {
|
|||
@warn_unused_result
|
||||
public func times(count: Int) -> AnyMatcher<[StubCall]> {
|
||||
return FunctionMatcher(function: compareCalls(count, using: ==), describeMismatch: describeCallMismatch) {
|
||||
$0.append(text: "Expected to be called ").append(value: count).append(text: " times ")
|
||||
$0.append(text: "to be called ").append(value: count).append(text: " times ")
|
||||
}.typeErased()
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public func atLeastOnce() -> AnyMatcher<[StubCall]> {
|
|||
@warn_unused_result
|
||||
public func atLeast(count: Int) -> AnyMatcher<[StubCall]> {
|
||||
return FunctionMatcher(function: compareCalls(count, using: >=), describeMismatch: describeCallMismatch) {
|
||||
$0.append(text: "Expected to be called at least ").append(value: count).append(text: " times ")
|
||||
$0.append(text: "to be called at least ").append(value: count).append(text: " times ")
|
||||
}.typeErased()
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public func atLeast(count: Int) -> AnyMatcher<[StubCall]> {
|
|||
@warn_unused_result
|
||||
public func atMost(count: Int) -> AnyMatcher<[StubCall]> {
|
||||
return FunctionMatcher(function: compareCalls(count, whenNil: true, using: <=), describeMismatch: describeCallMismatch) {
|
||||
$0.append(text: "Expected to be called at most ").append(value: count).append(text: " times ")
|
||||
$0.append(text: "to be called at most ").append(value: count).append(text: " times ")
|
||||
}.typeErased()
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public func equalTo<T: AnyObject>(value: T) -> AnyMatcher<T> {
|
|||
@warn_unused_result
|
||||
public func equalTo<T>(value: T, equalWhen equalityFunction: (T, T) -> Bool) -> AnyMatcher<T> {
|
||||
return FunctionMatcher(original: value, function: equalityFunction) {
|
||||
$0.append(text: "Expected to be equal to ").append(value: value).append(character: " ")
|
||||
$0.append(text: "to be equal to ").append(value: value).append(character: " ")
|
||||
}.typeErased()
|
||||
}
|
||||
|
||||
|
|
|
@ -23,27 +23,27 @@ class MatcherDescriptionsTest: XCTestCase {
|
|||
equalTo(10).describeTo(stringDescription)
|
||||
equalTo(10).describeMismatch(20, to: stringDescription)
|
||||
|
||||
XCTAssertEqual(stringDescription.description, "Expected to be equal to <10> was <20>")
|
||||
XCTAssertEqual(stringDescription.description, "to be equal to <10> was <20>")
|
||||
}
|
||||
|
||||
func testCalledTimes() {
|
||||
times(10).describeTo(stringDescription)
|
||||
times(10).describeMismatch([], to: stringDescription)
|
||||
|
||||
XCTAssertEqual(stringDescription.description, "Expected to be called <10> times was called <0> times")
|
||||
XCTAssertEqual(stringDescription.description, "to be called <10> times was called <0> times")
|
||||
}
|
||||
|
||||
func testCalledAtLest() {
|
||||
atLeast(10).describeTo(stringDescription)
|
||||
atLeast(10).describeMismatch([], to: stringDescription)
|
||||
|
||||
XCTAssertEqual(stringDescription.description, "Expected to be called at least <10> times was called <0> times")
|
||||
XCTAssertEqual(stringDescription.description, "to be called at least <10> times was called <0> times")
|
||||
}
|
||||
|
||||
func testCalledAtMost() {
|
||||
atMost(10).describeTo(stringDescription)
|
||||
atMost(10).describeMismatch([], to: stringDescription)
|
||||
|
||||
XCTAssertEqual(stringDescription.description, "Expected to be called at most <10> times was called <0> times")
|
||||
XCTAssertEqual(stringDescription.description, "to be called at most <10> times was called <0> times")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue