diff options
| author | Philipp Stephani <phst@google.com> | 2020-12-07 21:41:40 +0100 |
|---|---|---|
| committer | Philipp Stephani <phst@google.com> | 2020-12-07 21:41:40 +0100 |
| commit | 0155bd0fdb166c97a2ce76cc5bc64fd195a676d3 (patch) | |
| tree | 0746cc2410658fc03931dfeb942cd8b477965dd4 /test/lisp/emacs-lisp | |
| parent | 0c330bed24ef045732a1bfe61d20ed8328dd0b28 (diff) | |
| download | emacs-0155bd0fdb166c97a2ce76cc5bc64fd195a676d3.tar.gz | |
Fix bug in how ERT invokes its debugger.
The debugger needs to receive a list of the error symbol and data;
cf. the documentation of the `debugger' variable. This bug manifested
itself in ERT forms such as (should (integerp (ert-fail "Boo"))),
which resulted in an incorrect condition object. Note that forms such
as (should (ert-fail "Boo")) weren't affected because they wouldn't
use the `ert--should-signal-hook'.
* test/emacs-lisp/ert.el (ert--should-signal-hook): Call debugger with
the right arguments.
* test/lisp/emacs-lisp/ert-tests.el (ert-test-fail-inside-should): Add
unit test.
Diffstat (limited to 'test/lisp/emacs-lisp')
| -rw-r--r-- | test/lisp/emacs-lisp/ert-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 1f54c8d07e4..a0c56be0cb0 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -806,6 +806,16 @@ This macro is used to test if macroexpansion in `should' works." :expected-result :failed ;; FIXME! Bug#11218 (should-not (with-demoted-errors (error "Foo")))) +(ert-deftest ert-test-fail-inside-should () + "Check that `ert-fail' inside `should' works correctly." + (let ((result (ert-run-test + (make-ert-test + :name 'test-1 + :body (lambda () (should (integerp (ert-fail "Boo")))))))) + (should (ert-test-failed-p result)) + (should (equal (ert-test-failed-condition result) + '(ert-test-failed ("Boo")))))) + (provide 'ert-tests) |
