[swift-evolution] Testing Assertions
Tony Parker
anthony.parker at apple.com
Mon Jan 4 18:42:11 CST 2016
Hi Mohamed,
I agree it’s very difficult to test assertions in XCTest today. This approach looks interesting, but I’m not sure how it’s possible to implement within XCTest’s current architecture. Do you have any idea how this would be implemented?
- Tony
> On Dec 31, 2015, at 1:35 AM, Mohamed Ebrahim Afifi via swift-evolution <swift-evolution at swift.org> wrote:
>
> 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 <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 <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 <https://github.com/apple/swift/blob/master/validation-test/stdlib/Assert.swift>
>
> What do you think?
>
> Best Regards,
> Mohamed Afifi
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160104/93b5edcd/attachment.html>
More information about the swift-evolution
mailing list