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
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
Loading