Helpers
-
Allows to verify if error was thrown, and if it is of given type.
Declaration
Swift
public func XCTAssertThrowsError<T, E: Error>(_ expression: @autoclosure () throws -> T, of error: E.Type, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)Parameters
expressionExpression
errorExpected error type
messageOptional message
fileFile (optional)
lineLine (optional)
-
Allows to verify if error was throws, and if its exactly the one expected.
Declaration
Swift
public func XCTAssertThrowsError<T, E>(_ expression: @autoclosure () throws -> T, error: E, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where E: Error, E: EquatableParameters
expressionExpression
errorExpected error conforming to Equatable, Error
messageOptional message
fileFile (optional)
lineLine (optional)
View on GitHub
Helpers Reference