[swift-evolution] Testing Assertions

Mohamed Ebrahim Afifi mohamede1945 at gmail.com
Thu Dec 31 03:35:58 CST 2015


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
https://github.com/mohamede1945/AssertionsTestingExample

So, my suggestion is to add for XCTest something very similar to
*expectCrashLater* that is defined here
https://github.com/apple/swift/blob/9b15d03b73b9e8a6dbd3f71b5c78660a359e8e26/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb
and used in tests like this example
https://github.com/apple/swift/blob/master/validation-test/stdlib/Assert.swift

What do you think?

Best Regards,
Mohamed Afifi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151231/18dfb5b8/attachment.html>


More information about the swift-evolution mailing list