Skip to content

Commit

Permalink
Merge branch 'main' into failable_map_matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
younata authored Dec 12, 2024
2 parents 11d5adb + 51d5438 commit e7b6cb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Nimble/Matchers/BeIdenticalTo.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// A Nimble matcher that succeeds when the actual value is the same instance
/// as the expected instance.
public func beIdenticalTo(_ expected: AnyObject?) -> Matcher<AnyObject> {
public func beIdenticalTo<T: AnyObject>(_ expected: T?) -> Matcher<T> {
return Matcher.define { actualExpression in
let actual = try actualExpression.evaluate()

Expand Down Expand Up @@ -35,7 +35,7 @@ public func !== (lhs: AsyncExpectation<AnyObject>, rhs: AnyObject?) async {
/// as the expected instance.
///
/// Alias for "beIdenticalTo".
public func be(_ expected: AnyObject?) -> Matcher<AnyObject> {
public func be<T: AnyObject>(_ expected: T?) -> Matcher<T> {
return beIdenticalTo(expected)
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ final class BeIdenticalToObjectTest: XCTestCase {

func testBeIdenticalToPositive() {
expect(self.testObjectA).to(beIdenticalTo(testObjectA))
// check that the typing works out when used as a submatcher.
expect(self.testObjectA).to(map({ $0 }, beIdenticalTo(testObjectA)))
}

func testBeIdenticalToNegative() {
Expand Down

0 comments on commit e7b6cb5

Please sign in to comment.