diff options
| author | Stefan Kangas | 2025-03-23 17:40:22 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-03-23 17:46:07 +0100 |
| commit | c2c287b3252e2cd3223f2e2d0ef96f29e024b47b (patch) | |
| tree | abe02ea0b1a5d6dbcb2f6e34ffd1374066f5debe | |
| parent | c6a11128d58e8ee4c21741c439d79da420378818 (diff) | |
| download | emacs-c2c287b3252e2cd3223f2e2d0ef96f29e024b47b.tar.gz emacs-c2c287b3252e2cd3223f2e2d0ef96f29e024b47b.zip | |
Improve docstring of should-error
* lisp/emacs-lisp/ert.el (should-error): Improve docstring.
| -rw-r--r-- | lisp/emacs-lisp/ert.el | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 02551bad31f..731e8d1a40a 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el | |||
| @@ -422,16 +422,23 @@ and aborts the current test as failed if it doesn't." | |||
| 422 | (cl-defmacro should-error (form &rest keys &key type exclude-subtypes) | 422 | (cl-defmacro should-error (form &rest keys &key type exclude-subtypes) |
| 423 | "Evaluate FORM and check that it signals an error. | 423 | "Evaluate FORM and check that it signals an error. |
| 424 | 424 | ||
| 425 | The error signaled needs to match TYPE. TYPE should be a list | 425 | If no error was signaled, abort the test as failed and |
| 426 | of condition names. (It can also be a non-nil symbol, which is | 426 | return (ERROR-SYMBOL . DATA) from the error. |
| 427 | equivalent to a singleton list containing that symbol.) If | 427 | |
| 428 | EXCLUDE-SUBTYPES is nil, the error matches TYPE if one of its | 428 | You can also match specific errors using the KEYWORD-ARGS arguments, |
| 429 | condition names is an element of TYPE. If EXCLUDE-SUBTYPES is | 429 | which is specified as keyword/argument pairs. The following arguments |
| 430 | non-nil, the error matches TYPE if it is an element of TYPE. | 430 | are defined: |
| 431 | 431 | ||
| 432 | If the error matches, returns (ERROR-SYMBOL . DATA) from the | 432 | :type TYPE -- If TYPE is non-nil, the error signaled needs to match |
| 433 | error. If not, or if no error was signaled, abort the test as | 433 | TYPE. TYPE should be a list of condition names. It can also be a |
| 434 | failed." | 434 | symbol, which is equivalent to a one-element list containing that |
| 435 | symbol. | ||
| 436 | |||
| 437 | :exclude-subtypes EXCLUDED -- If EXCLUDED is non-nil, the error matches | ||
| 438 | TYPE only if it is an element of TYPE. If nil (the default), the error | ||
| 439 | matches TYPE if one of its condition names is an element of TYPE. | ||
| 440 | |||
| 441 | \(fn FORM &rest KEYWORD-ARGS)" | ||
| 435 | (declare (debug t)) | 442 | (declare (debug t)) |
| 436 | (unless type (setq type ''error)) | 443 | (unless type (setq type ''error)) |
| 437 | (ert--expand-should | 444 | (ert--expand-should |