[swift-evolution] Solving the issue of unit-testing precondition with the Standard Library?

David Hart david at hartbit.com
Sat Mar 12 15:41:39 CST 2016


I am deeply interested in finding solutions for allowing unit-tests of preconditions. Without them, I believe we are leaving many holes in our tests and coverage. The solution found in the Swift project of forking the process seems fairly complicated to implement in XCTest.

I found a solution online that works by overriding the precondition function with a function that calls a configurable closure which defaults to the original precondition function. It would be great if the Standard Library allowed this by default so that XCTest could use it to offer full support for precondition unit tests.

http://stackoverflow.com/a/31349339

Is this imaginable?



More information about the swift-evolution mailing list