<div dir="ltr"><div>Right now, we cannot easily test failed assertions (assert, assertionFailure, precondition, preconditionFailure, fatalError) in our own code without some hacks in the code under test. Like this example <a href="https://github.com/mohamede1945/AssertionsTestingExample">https://github.com/mohamede1945/AssertionsTestingExample</a></div><div><br></div><div>So, my suggestion is to add for XCTest something very similar to <b>expectCrashLater</b> that is defined here <a href="https://github.com/apple/swift/blob/9b15d03b73b9e8a6dbd3f71b5c78660a359e8e26/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb">https://github.com/apple/swift/blob/9b15d03b73b9e8a6dbd3f71b5c78660a359e8e26/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb</a></div><div>and used in tests like this example <a href="https://github.com/apple/swift/blob/master/validation-test/stdlib/Assert.swift">https://github.com/apple/swift/blob/master/validation-test/stdlib/Assert.swift</a></div><div><br></div><div>What do you think?</div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Best Regards,<div>Mohamed Afifi</div></div></div></div></div></div>
</div>