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

Marc Knaup marc at knaup.koeln
Sun Dec 13 08:18:20 CST 2015


+1 from me. I'm really annoyed by the fact I can't reach 100% code coverage
due to this :)

Being able to test them is very valuable. Take Swift's promise to be safe
for example. If you can't test the behavior in cases where an array index
was used which is out of bounds then you can't test even the promise to be
safe.

On Sun, Dec 13, 2015 at 11: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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20151213/689e1850/attachment.html>


More information about the swift-corelibs-dev mailing list