Created
June 23, 2019 00:36
-
-
Save krzyzanowskim/a70b8e782ce031518fcbda4f69616b4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func XCTAssertThrowsError2<T>(_ expression: () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line, _ errorHandler: (Error) -> Void = { _ in }) { | |
do { | |
_ = try expression() | |
XCTFail(message()) | |
} catch { | |
errorHandler(error) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment