[swift-evolution] Language or XCTest improvements to allow testing assert/precondition failures

Joe Groff jgroff at apple.com
Tue Feb 2 11:17:40 CST 2016


As it stands today, having the test harness run the test under a separate process, the way StdlibUnittest does, is the best approach IMO. Making failure traps even conditionally recoverable would be a fairly large semantic design and codegen complication. In the bright distant future where we have an actor model, then actor failures might be isolatable.

-Joe

> On Dec 13, 2015, at 2:03 AM, David Hart via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Currently, it is impossible for XCTest to unit test assert and precondition failures because they kill the process. And those are important to unit test: how would you test NSArray's objectAtIndex bound conditions? Currently, the standard library tests those with StdlibUnittest, a small piece of code which runs those tests in a forked process.
> 
> I want to start a proposal but I'm not sure if it should come as a XCTest improvement which spawns a process or if the language should implement assert and precondition as a special kind of throw?
> 
> David
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list