[swift-users] Parameter Validation

Jens Alfke jens at mooseyard.com
Mon Dec 7 11:25:07 CST 2015

> On Dec 7, 2015, at 9:21 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> Yes you can.  Maybe not with the current XCTest, but there's nothing that prevents unit-testing traps in principle.  The standard library is already doing that.  See test/1_stdlib/ArrayTraps.swift.gyb for some examples:

Nice! But completely undocumented, AFAIK. This is the first I’ve heard of the term “trap” or a way to handle them. The docs I’ve seen just say that an assertion failure terminates the process.

Is there any more info about traps, other than “Read the source, Luke?” ;-)

(This is one reason I’ve been excited for the open source release — finally getting to look behind the scenes of some of the “magic” stuff.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151207/4814aca9/attachment.html>

More information about the swift-users mailing list