asserts.throws(command, expectedSubstring)
asserts.throws(command, expectedSubstring, expectedIdentifier)
[res, msg] = asserts.throws(command, expectedSubstring)
| Parameter | Description |
|---|---|
| command | Command string evaluated in the current context. |
| expectedSubstring | Expected substring in the error message. |
| expectedIdentifier | Optional expected error identifier. |
| Parameter | Description |
|---|---|
| res | true if the assertion passes, false otherwise. |
| msg | assertion failure message, empty on success. |
The assertion passes when the command raises an error whose message contains expectedSubstring.
Use asserts.checkerror when the full error message must match.
asserts.throws('cos', _('Wrong number of input arguments.'));
[res, msg] = asserts.throws('1 + 1', 'unused');
| Version | Description |
|---|---|
| 2.0.0 | initial version |