Skip to content

Commit

Permalink
test: fix existing unit tests of OCMock where now, by default, `objcV…
Browse files Browse the repository at this point in the history
…erify`'s quantifier is `.exactly(1)` instead of `.atLeast(1)`
  • Loading branch information
ajpallares authored and MatyasKriz committed Apr 22, 2024
1 parent ba0eb9e commit 2a28139
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Tests/OCMock/ObjectiveClassTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ final class ObjectiveClassTest: XCTestCase {
XCTAssertFalse(mock.dudka(lelo: "heya"))
XCTAssertTrue(mock.dudka(lelo: "heyda"))

objcVerify(mock.dudka(lelo: objcAny()))
objcVerify(mock.dudka(lelo: objcAny()), .atLeast(1))
}

func testVerifyAtLeast() {
Expand Down
6 changes: 3 additions & 3 deletions Tests/OCMock/ObjectiveProtocolTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ final class ObjectiveProtocolTest: XCTestCase {

objcVerify(mock.tableView!(objcAny(), canFocusRowAt: IndexPath(row: 0, section: 22)))
objcVerify(mock.tableView!(tableView, canFocusRowAt: IndexPath(row: 0, section: 22)))
objcVerify(mock.tableView!(objcAny(), canFocusRowAt: IndexPath(row: 1, section: 22)))
objcVerify(mock.tableView!(objcAny(), canFocusRowAt: IndexPath(row: 1, section: 22)), .atLeast(1))
objcVerify(mock.tableView!(tableView, canFocusRowAt: IndexPath(row: 1, section: 22)))
objcVerify(mock.tableView!(objcAny(), canFocusRowAt: IndexPath(row: 1, section: 22)))
objcVerify(mock.tableView!(objcAny(), canFocusRowAt: IndexPath(row: 1, section: 22)), .atLeast(1))
objcVerify(mock.tableView!(tableView, canFocusRowAt: IndexPath(row: 1, section: 22)))
}

Expand Down Expand Up @@ -65,7 +65,7 @@ final class ObjectiveProtocolTest: XCTestCase {

objcVerify(mock.textField!(objcAny(), shouldChangeCharactersIn: range, replacementString: "Hello from the other side, ObjC!"))
objcVerify(mock.textField!(objcAny(), shouldChangeCharactersIn: range, replacementString: "TadeasKriz is a HaXoR."))
objcVerify(mock.textField!(objcAny(), shouldChangeCharactersIn: range, replacementString: objcAny()))
objcVerify(mock.textField!(objcAny(), shouldChangeCharactersIn: range, replacementString: objcAny()), .atLeast(1))
}

// NOTE: This is an example of a wrong way to test an optional method.
Expand Down

0 comments on commit 2a28139

Please sign in to comment.