Skip to main content

to_satisfy

Method of AlephExpectation.

Overloads

NameDescription
to_satisfy(const Function<Object(Object)> predicate) -> voidRecords a failure unless the predicate returns true for the actual value.
to_satisfy(const Function<Object(Object)> predicate, const Map options) -> voidRecords a failure unless the predicate returns true for the actual value.

to_satisfy(const Function<Object(Object)> predicate) -> void

Records a failure unless the predicate returns true for the actual value.

Parameters

  • predicate: Function called with the actual value.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(value).to_satisfy(fun[](v) { v > 0 })

to_satisfy(const Function<Object(Object)> predicate, const Map options) -> void

Records a failure unless the predicate returns true for the actual value.

Parameters

  • predicate: Function called with the actual value.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.

Returns

Nothing. Failed expectations are collected in the active test result.

Example


expect(value).to_satisfy(fun[](v) { v > 0 }, ["message": "expected a positive value"])