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)
-
You can use this class if there is need to define custom assertion handler. You can use its static handler closure to alter default behaviour.
If it is
See morenil, the defaultassertmethod would be used.Declaration
Swift
public final class MockyAssertion
View on GitHub
Helpers Reference