Example

public struct Example
extension Example: Hashable
extension Example: Comparable

Captures code and context information for an example of a triggering or non-triggering style

  • The contents of the example

    Declaration

    Swift

    public private(set) var code: String
  • The path to the file where the example was created

    Declaration

    Swift

    public private(set) var file: StaticString
  • The line in the file where the example was created

    Declaration

    Swift

    public var line: UInt
  • Create a new Example with the specified code, file, and line

    Declaration

    Swift

    init(_ code: String, file: StaticString = #file, line: UInt = #line)

    Parameters

    code

    The contents of the example

    file

    The path to the file where the example is located. Defaults to the file where this initializer is called.

    line

    The line in the file where the example is located. Defaults to the line where this initializer is called.

  • Returns the same example, but with the code that is passed in

    Declaration

    Swift

    func with(code: String) -> Example

    Parameters

    code

    the new code to use in the modified example

  • Returns a copy of the Example with all instances of the “↓” character removed.

    Declaration

    Swift

    func removingViolationMarkers() -> Example
  • Declaration

    Swift

    public static func == (lhs: Example, rhs: Example) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Declaration

    Swift

    public static func < (lhs: Example, rhs: Example) -> Bool