Hello all! Here is a refined pitch originally posted to the Development > Swift Testing subcategory.
Read the full proposal here.
There is a full implementation available here. To try it out, follow these steps:
- Add my fork of Swift Testing as a dependency, specifying the
polling-expectations
branch.- Add
.package(url: "https://github.com/younata/swift-testing.git", branch: "polling-expectations")
to thedependencies
list in your Package.swift.
- Add
- When importing, use the
Experimental
spi.- Import testing as
@_spi(Experimental) import Testing
.
- Import testing as
Polling confirmations adds the ability to repeatedly poll a closure until a given condition is reached. This is extremely useful for checking the state of something that happens in a background thread when you donât have some better mechanism to get notified by it. I think itâll be a very welcome addition to the Testing library.