Function

XCTAssert(_:_:file:line:)

Asserts that an expression is true.

Declaration

func XCTAssert(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String = default, file: StaticString = #file, line: UInt = #line)

Parameters

expression

An expression of boolean type.

message

An optional description of the failure.

file

The file in which failure occurred. Defaults to the file name of the test case in which this function was called.

line

The line number on which failure occurred. Defaults to the line number on which this function was called.

Discussion

Generates a failure when expression == false. Equivalent to XCTAssertTrue(_:_:file:line:).

See Also

Testing if a Condition is True