Skip to content

Commit

Permalink
Add local variable to DRY implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller committed Feb 13, 2024
1 parent 98cc327 commit ec6dd87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Tests/LayoutTests/Support/NimbleMatchers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ extension XCTestCase {
Matcher { expression in
guard let constraint: NSLayoutConstraint = try expression.evaluate()
else { return MatcherResult(status: .fail, message: .expectedTo("not be nil, got <nil>")) }
guard constraint.isActive == isActive ?? expectedConstraint.isActive
let isActiveExpected: Bool = isActive ?? expectedConstraint.isActive
guard constraint.isActive == isActiveExpected
else {
let message: String = """
match `isActive` <\(isActive ?? expectedConstraint.isActive)>, \
match `isActive` <\(isActiveExpected)>, \
got <\(constraint.isActive)>
"""
return MatcherResult(status: .fail, message: .expectedTo(message))
Expand Down

0 comments on commit ec6dd87

Please sign in to comment.