Skip to content

Commit 30509f1

Browse files
committed
StdlibUnittest: add an argument label to checkHashable
I think it improves readability of the callsite.
1 parent 605218d commit 30509f1

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ public func checkHashable<Instances : Collection>(
20732073
}
20742074

20752075
public func checkHashable<T : Hashable>(
2076-
_ expectedEqual: Bool, _ lhs: T, _ rhs: T, ${TRACE}
2076+
expectedEqual: Bool, _ lhs: T, _ rhs: T, ${TRACE}
20772077
) {
20782078
checkHashable(
20792079
[lhs, rhs], equalityOracle: { expectedEqual || $0 == $1 }, ${trace})

test/stdlib/FloatingPoint.swift.gyb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,9 @@ func checkFloatingPointComparison_${FloatSelf}(
518518
let message = { "expected: lhs=\(lhs) \(expected) rhs=\(rhs)" }
519519
expectEqual(expected.isEQ(), lhs == rhs, message(), stackTrace: newTrace)
520520
expectEqual(expected.isNE(), lhs != rhs, message(), stackTrace: newTrace)
521-
checkHashable(expected.isEQ(), lhs, rhs, message(), stackTrace: newTrace)
521+
checkHashable(
522+
expectedEqual: expected.isEQ(),
523+
lhs, rhs, message(), stackTrace: newTrace)
522524

523525
expectEqual(expected.isLT(), lhs < rhs, message(), stackTrace: newTrace)
524526
expectEqual(expected.isLE(), lhs <= rhs, message(), stackTrace: newTrace)

test/stdlib/StringAPI.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ func checkStringComparison(
145145
expectEqual(expected.isEQ(), lhs == rhs, stackTrace: stackTrace)
146146
expectEqual(expected.isNE(), lhs != rhs, stackTrace: stackTrace)
147147
checkHashable(
148-
expected.isEQ(), lhs, rhs, stackTrace: stackTrace.withCurrentLoc())
148+
expectedEqual: expected.isEQ(),
149+
lhs, rhs, stackTrace: stackTrace.withCurrentLoc())
149150

150151
expectEqual(expected.isLT(), lhs < rhs, stackTrace: stackTrace)
151152
expectEqual(expected.isLE(), lhs <= rhs, stackTrace: stackTrace)
@@ -167,7 +168,8 @@ func checkStringComparison(
167168
!expectedEqualUnicodeScalars, lhsNSString != rhsNSString,
168169
stackTrace: stackTrace)
169170
checkHashable(
170-
expectedEqualUnicodeScalars, lhsNSString, rhsNSString,
171+
expectedEqual: expectedEqualUnicodeScalars,
172+
lhsNSString, rhsNSString,
171173
stackTrace: stackTrace.withCurrentLoc())
172174
#endif
173175
}
@@ -215,7 +217,8 @@ func checkCharacterComparison(
215217
expectEqual(expected.isEQ(), lhs == rhs, stackTrace: stackTrace)
216218
expectEqual(expected.isNE(), lhs != rhs, stackTrace: stackTrace)
217219
checkHashable(
218-
expected.isEQ(), lhs, rhs, stackTrace: stackTrace.withCurrentLoc())
220+
expectedEqual: expected.isEQ(),
221+
lhs, rhs, stackTrace: stackTrace.withCurrentLoc())
219222

220223
expectEqual(expected.isLT(), lhs < rhs, stackTrace: stackTrace)
221224
expectEqual(expected.isLE(), lhs <= rhs, stackTrace: stackTrace)

0 commit comments

Comments
 (0)