Skip to content

Example

Oleksandr Bretsko edited this page Dec 27, 2020 · 1 revision

Example

Examples, defined with the it function, use assertions to demonstrate how code should behave. These are like "tests" in XCTest.

final public class Example: _ExampleBase

Inheritance

_ExampleBase, _ExampleBase

Properties

isSharedExample

A boolean indicating whether the example is a shared example; i.e.:​ whether it is an example defined with itBehavesLike.

var isSharedExample = false

callsite

The site at which the example is defined. This must be set correctly in order for Xcode to highlight the correct line in red when reporting a failure.

var callsite: Callsite

description

var description: String

name

The example name. A name is a concatenation of the name of the example group the example belongs to, followed by the description of the example itself.

var name: String

The example name is used to generate a test method selector to be displayed in Xcode's test navigator.

Methods

run()

Executes the example closure, as well as all before and after closures defined in the its surrounding example groups.

public func run()

==(lhs:rhs:)

Returns a boolean indicating whether two Example objects are equal. If two examples are defined at the exact same callsite, they must be equal.

@nonobjc public static func ==(lhs: Example, rhs: Example) -> Bool
Types
Protocols
Global Typealiases
Global Variables
Global Functions
  • MACH_MSGH_BITS(_:_:)
  • MACH_MSGH_BITS_REMOTE(_:)
  • QCKMain(_:configurations:testCases:)
  • __allTests()
  • afterEach(_:)
  • afterSuite(_:)
  • allPass(_:)
  • allPass(_:_:)
  • assertClose(_:_:allowedError:file:line:)
  • assertClose(_:_:allowedError:worstError:file:line:)
  • be(_:)
  • beAKindOf(_:)
  • beAnInstanceOf(_:)
  • beCloseTo(_:within:)
  • beEmpty()
  • beFalse()
  • beFalsy()
  • beGreaterThan(_:)
  • beGreaterThanOrEqualTo(_:)
  • beIdenticalTo(_:)
  • beLessThan(_:)
  • beLessThanOrEqualTo(_:)
  • beNil()
  • beTrue()
  • beTruthy()
  • beVoid()
  • beforeEach(_:)
  • beforeSuite(_:)
  • beginWith(_:)
  • catchBadInstruction(block:)
  • catchBadInstruction(in:)
  • chain(_:_:)
  • contain(_:)
  • containElementSatisfying(_:_:)
  • context(_:flags:closure:)
  • crashIf(_:_:)
  • crashIfAnyFalse(_:_:)
  • crashIfAnyFalse(_:crashMessage:)
  • crashIfAnyFalse(_:message:)
  • crashIfAnyNotExpected(_:expected:_:)
  • crashIfAnyNotExpected(_:expected:crashMessage:)
  • crashIfAnyTrue(_:_:)
  • crashIfFalse(_:_:)
  • crashIfNegative(_:)
  • crashIfNil(_:)
  • crashIfNotEqual(_:)
  • crashIfNotEqual(_:_:)
  • crashIfNotExpected(_:expected:_:)
  • crashIfNotNil(_:)
  • describe(_:flags:closure:)
  • doubleForLoop(_:_:)
  • elementsEqual(_:)
  • elementsEqual(_:by:)
  • encode(encodable:)
  • endWith(_:)
  • equal(_:)
  • expect(_:file:line:)
  • expect(_:line:expression:)
  • fail(_:file:line:)
  • fail(_:line:)
  • fail(_:location:)
  • fcontext(_:flags:closure:)
  • fdescribe(_:flags:closure:)
  • fit(_:flags:file:line:closure:)
  • fitBehavesLike(_:flags:file:line:)
  • fitBehavesLike(_:flags:file:line:context:)
  • fitBehavesLike(_:flags:file:line:sharedExampleContext:)
  • gatherExpectations(silently:closure:)
  • gatherFailingExpectations(silently:closure:)
  • haveCount(_:)
  • isValidLength(_:)
  • it(_:flags:file:line:closure:)
  • itBehavesLike(_:flags:file:line:)
  • itBehavesLike(_:flags:file:line:context:)
  • itBehavesLike(_:flags:file:line:sharedExampleContext:)
  • match(_:)
  • matchError(_:)
  • pending(_:closure:)
  • postNotifications(_:fromNotificationCenter:)
  • prettyCollectionType(_:)
  • product(_:_:)
  • raiseException(named:reason:userInfo:closure:)
  • recordFailure(_:location:)
  • satisfyAllOf(_:)
  • satisfyAnyOf(_:)
  • sharedExamples(_:closure:)
  • stringify(_:)
  • succeed()
  • threadSingleton(_:)
  • throwAssertion()
  • throwError()
  • throwError(_:closure:)
  • throwError(closure:)
  • throwError(errorType:closure:)
  • uuid()
  • waitUntil(timeout:file:line:action:)
  • withAssertionHandler(_:file:line:closure:)
  • xcontext(_:flags:closure:)
  • xdescribe(_:flags:closure:)
  • xit(_:flags:file:line:closure:)
  • xitBehavesLike(_:flags:file:line:context:)
Operators
  • !=(lhs:rhs:)
  • !==(lhs:rhs:)
  • &&(left:right:)
  • **(lhs:rhs:)
  • <(lhs:rhs:)
  • <=(lhs:rhs:)
  • ==(lhs:rhs:)
  • ===(lhs:rhs:)
  • >(lhs:rhs:)
  • >=(lhs:rhs:)
  • ||(left:right:)
  • ~=(regex:input:)
  • ±(Float:)
  • ±(double:)
  • ±(lhs:rhs:)
  • √(double:)
  • ≈(lhs:rhs:)

Clone this wiki locally