mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Based on its argument names and messages, `expectEqual` and friends expects the expected value of the calculation being tested to be provided as its first argument, and the actual value as the second: ``` expectEqual(4, 2 + 2) ``` This does not always match actual use -- folks like myself find the opposite ordering far more natural: ``` expectEqual(2 + 2, 4) ``` `expectEqual` currently uses the `expected`/`actual` terminology in its failure messages, causing confusion and needless suffering. Change `expectEqual`'s declaration and error messages to use a naming scheme that does not assume specific roles for the two arguments. (Namely, use `first`/`second` instead of `expected`/`actual`.) An alternative way to solve this would be to use argument labels, as in `expectEqual(expected: 4, actual: 2 + 2)`, or to introduce some sort of expression builder scheme such as `expect(2 + 2).toEqual(2)`. These seem needlessly fussy and overly clever, respectively.