Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

test(_:_:file:line:)

mattt edited this page Jan 8, 2021 · 1 revision

test(_:_:file:line:)

Creates a test from an expression that returns a Boolean value.

public func test(_ body: @escaping @autoclosure () throws -> Bool, _ description: String? = nil, file: String = #filePath, line: Int = #line) -> Test

Parameters

  • body: A closure containing the tested behavior, Return true to indicate successful execution or false to indicate test failure. Throw a Directiveto indicate how a test should be interpreted, or throwBailOut` to stop the execution of further tests.
  • description: A description of the tested behavior. nil by default.
  • file: The source code file in which this test occurs.
  • line: The line in source code on which this test occurs.

Returns

A test.

test(_:_:file:line:)

Creates a test from a closure that returns a Boolean value.

public func test(_ body: @escaping () throws -> Bool, _ description: String? = nil, file: String = #filePath, line: Int = #line) -> Test

Parameters

  • body: A closure containing the tested behavior, Return true to indicate successful execution or false to indicate test failure. Throw a Directiveto indicate how a test should be interpreted, or throwBailOut` to stop the execution of further tests.
  • description: A description of the tested behavior. nil by default.
  • file: The source code file in which this test occurs.
  • line: The line in source code on which this test occurs.

Returns

A test.

Clone this wiki locally