1.1.0
What's Changed
-
Added:
XCTAssertDifference
for testing changes to values (#51).This function evaluates a given expression before and after a given operation and then compares the results. The comparison is done by invoking the
changes
closure with a mutable version of the initial value, and then asserting that the modifications made match the final value usingXCTAssertNoDifference
.For example, given a very simple counter structure, we can write a test against its incrementing functionality:
struct Counter { var count = 0 var isOdd = false mutating func increment() { self.count += 1 self.isOdd.toggle() } } var counter = Counter() XCTAssertDifference(counter) { counter.increment() } changes: { $0.count = 1 $0.isOdd = true }
If
changes
does not exhaustively describe all changed fields, the assertion will fail.By omitting the operation you can write a "non-exhaustive" assertion against a value by describing just the fields you want to assert against in the
changes
closure:counter.increment() XCTAssertDifference(counter) { $0.count = 1 // Don't need to further describe how `isOdd` has changed }
-
Infrastructure: README updates (thanks @JacksonUtsch, #96).
-
Infrastructure: Enable Windows CI (thanks @brianmichel, #99).
New Contributors
- @JacksonUtsch made their first contribution in #96
- @brianmichel made their first contribution in #99
Full Changelog: 1.0.0...1.1.0