<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">+1</div><div class=""><br class=""></div><div class="">I would like to test both asserts and preconditions too.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 13 Dec 2015, at 15:18, Marc Knaup via swift-corelibs-dev &lt;<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">+1 from me. I'm really annoyed by the fact I can't reach 100% code coverage due to this :)<div class=""><br class=""></div><div class=""><font face="arial, helvetica, sans-serif" class="">Being able to test them is very valuable.&nbsp;</font><span style="font-family:arial,helvetica,sans-serif" class="">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.</span></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Dec 13, 2015 at 11:03 AM, David Hart via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br class="">
<br class="">
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?<br class="">
<br class="">
David<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=j4IybsUIPYHiRcwUyRdFaSyY9hW0Q-2F-2F4mkUT8Mp-2BrkXgldTfv9N9P55WauqQSTV5y79RWcEMJcds5HRz253c0gASlhplaR-2FHC-2FYTPzqo76WPFZ8-2FZctHG-2BcbUJrdP1T2iYwUdEYvy053ud2ZpvqWrHwlnq4MFTrFIM93FUnLiXwAx49abBy-2B9ZFlDoSpKAA2MsYo49gPatxEzr3Nyj7t1w-3D-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev<br class=""></div></blockquote></div><br class=""></body></html>