v7.2.0 - TestState property wrapper
Highlight
You can now use the @TestState property wrapper to automatically deconstruct test variables. For example:
describe("using TestState") {
@TestState var subject: SomeObject?
}Is functionally equivalent to:
describe("using TestState") {
var subject: SomeObject?
afterEach {
subject = nil
}
}You can also specify an initial value, and TestState will act as an aroundEach: setting the wrapped variable to the value, then setting it to nil at test teardown.
describe("using TestState") {
@TestState(1) var value: Int?
it("is already configured") {
expect(value).to(equal(1))
}
}Thanks @CraigSiemens for their contribution!
Automated Release Notes
What's Changed
- Added a TestState property wrapper, again :D by @CraigSiemens in #1233
Full Changelog: v7.1.0...v7.2.0