asserts.warning(command, expectedWarning)
asserts.warning(command, expectedMessage, expectedIdentifier)
[res, msg] = asserts.warning(command, expectedWarning)
| Parameter | Description |
|---|---|
| command | Command string evaluated in the current context. |
| expectedWarning | Expected warning message substring or warning identifier. |
| expectedMessage | Expected warning message. |
| expectedIdentifier | Expected warning identifier. |
| Parameter | Description |
|---|---|
| res | true if the assertion passes, false otherwise. |
| msg | assertion failure message, empty on success. |
The assertion passes when the command emits a matching warning.
The two-argument form accepts either the warning message text or the warning identifier.
asserts.warning('warning(''Nelson:asserts:example'', ''expected warning'');', 'expected warning');
[res, msg] = asserts.warning('1 + 1', 'expected warning');
| Version | Description |
|---|---|
| 2.0.0 | initial version |