ExpectationMessage

public indirect enum ExpectationMessage

Undocumented

  • includes actual value in output (“expected to , got ”)

    Declaration

    Swift

    case expectedActualValueTo(String)
  • uses a custom actual value string in output (“expected to , got ”)

    Declaration

    Swift

    case expectedCustomValueTo(String, actual: String)
  • excludes actual value in output (“expected to ”)

    Declaration

    Swift

    case expectedTo(String)
  • allows any free-form message (“”)

    Declaration

    Swift

    case fail(String)
  • Not Fully Implemented Yet.

    Declaration

    Swift

    case prepends(String, ExpectationMessage)
  • appends after an existing message (“ (use beNil() to match nils)”)

    Declaration

    Swift

    case appends(ExpectationMessage, String)
  • provides long-form multi-line explainations (“\n\n”)

    Declaration

    Swift

    case details(ExpectationMessage, String)
  • Returns the smallest message after the “expected to” string that summarizes the error.

    Returns the message part from ExpectationMessage, ignoring all .appends and .details.

    Declaration

    Swift

    public var expectedMessage: String { get }
  • Appends a message after the primary expectation message

    Declaration

    Swift

    public func appended(message: String) -> ExpectationMessage
  • Appends a message hinting to use beNil() for when the actual value given was nil.

    Declaration

    Swift

    public func appendedBeNilHint() -> ExpectationMessage
  • Appends a detailed (aka - multiline) message after the primary expectation message Detailed messages will be placed after .appended(message:) calls.

    Declaration

    Swift

    public func appended(details: String) -> ExpectationMessage
  • Replaces a primary expectation with one returned by f. Preserves all composite expectations that were built upon it (aka - all appended(message:) and appended(details:).

    Declaration

    Swift

    public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage
  • Wraps a primary expectation with text before and after it. Alias to prepended(message: before).appended(message: after)

    Declaration

    Swift

    public func wrappedExpectation(before: String, after: String) -> ExpectationMessage
  • Prepends a message by modifying the primary expectation

    Declaration

    Swift

    public func prepended(expectation message: String) -> ExpectationMessage
  • Converts the tree of ExpectationMessages into a final built string.

    Declaration

    Swift

    public func toString(actual: String, expected: String = "expected", to: String = "to") -> String