<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 9:21 AM, Dmitri Gribenko &lt;<a href="mailto:gribozavr@gmail.com" class="">gribozavr@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Yes you can.&nbsp; Maybe not with the current XCTest, but there's nothing that prevents unit-testing traps in principle.&nbsp; The standard library is already doing that.&nbsp; See test/1_stdlib/ArrayTraps.swift.gyb for some examples:</div></div></blockquote></div><br class=""><div class="">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.</div><div class=""><br class=""></div><div class="">Is there any more info about traps, other than “Read the source, Luke?” ;-)</div><div class=""><br class=""></div><div class="">(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.)</div><div class=""><br class=""></div><div class="">—Jens</div></body></html>