to_throw
Method of AlephExpectation.
Overloads
| Name | Description |
|---|---|
to_throw() -> void | Records a failure unless the expected action throws. |
to_throw(const Map options) -> void | Records a failure unless the expected action throws. |
to_throw() -> void
Records a failure unless the expected action throws.
Returns
Nothing. Failed expectations are collected in the active test result.
Example
expect(fun[]() { throw(RuntimeError("boom")) }).to_throw()
to_throw(const Map options) -> void
Records a failure unless the expected action throws.
Parameters
- 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(fun[]() { throw(RuntimeError("boom")) }).to_throw(["message": "expected an exception"])