test subdirectory: Use new error-API

* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--run-maybe-unsupported-function): Remove dummy branch in
`condition-case`.
* test/lisp/arc-mode-tests.el (define-arc-mode-test-on-type):
Use `error-slot-value`.

* test/src/process-tests.el (process-tests--ignore-EMFILE):
* test/src/filelock-tests.el (filelock-tests-unlock-spoiled)
(filelock-tests-kill-buffer-spoiled):
* test/lisp/vc/vc-git-tests.el (vc-git-test--run):
* test/lisp/proced-tests.el (proced--assert-process-valid-cpu-refinement):
* test/lisp/emacs-lisp/pp-tests.el (pp-tests--sanity):
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-normal-env)
(edebug-tests-post-command):
* test/lisp/autorevert-tests.el (auto-revert--deftest-remote):
* test/infra/android/test-controller.el (ats-connect):
This commit is contained in:
Stefan Monnier 2026-03-09 22:40:31 -04:00
parent 9348c19b82
commit 6d8b3d1077
10 changed files with 14 additions and 17 deletions

View file

@ -1910,7 +1910,7 @@ this machine and an SSH daemon be executing on the host)."
(with-demoted-errors "Winding up failed connection: %S"
(ats-adb "-s" device "forward" "--remove"
(format "tcp:%d" host-port)))
(signal (car err) (cdr err))))))))))
(signal err)))))))))

View file

@ -113,9 +113,10 @@ member MEMBER. Then the test finds ARCHIVE and ensures that function
;; turn the most likely error into a nice
;; and self-explaining symbol that can be
;; compared in a `should'
(if (string= (cadr err) "Buffer format not recognized")
(if (equal (error-slot-value err 1)
"Buffer format not recognized")
'signature-not-recognized
(signal (car err) (cdr err))))))
(signal err)))))
(should (eq type (quote ,type)))))
(when buffer (kill-buffer buffer))
(dolist (file (list member archive))

View file

@ -203,7 +203,7 @@ It is checked for buffer-local `auto-revert-notify-watch-descriptor'."
(tramp-dissect-file-name auto-revert--test-rootdir) t 'keep-password)
(condition-case err
(funcall (ert-test-body ert-test))
(error (message "%s" err) (signal (car err) (cdr err)))))))
(error (message "%S" err) (signal err))))))
(defmacro with-auto-revert-test (&rest body)
(declare (debug t))

View file

@ -120,8 +120,7 @@ back to the top level.")
(eval-buffer)
,@body
(when edebug-tests-failure-in-post-command
(signal (car edebug-tests-failure-in-post-command)
(cdr edebug-tests-failure-in-post-command))))
(signal edebug-tests-failure-in-post-command)))
(unload-feature 'edebug-test-code)
(with-current-buffer (find-file-noselect edebug-tests-temp-file)
(set-buffer-modified-p nil))
@ -246,7 +245,7 @@ keyboard macro."
(funcall thunk)
(error
(setq edebug-tests-failure-in-post-command err)
(signal (car err) (cdr err)))))
(signal err))))
(setq edebug-tests-kbd-macro-index executing-kbd-macro-index))))
(defvar edebug-tests-func nil

View file

@ -82,7 +82,7 @@
(invalid-read-syntax
(message "Invalid fill result with i=%d:\n%s"
i (buffer-string))
(signal (car err) (cdr err))
(signal err)
))))))))
(ert-deftest pp-tests--bug76715 ()

View file

@ -61,7 +61,7 @@
(proced--move-to-column "%CPU")
(condition-case err
(>= (proced--cpu-at-point) cpu)
(ert-test-skipped (signal (car err) (cdr err)))
(ert-test-skipped (signal err))
(error
(ert-fail
(list err (proced--assert-process-valid-cpu-refinement-explainer cpu))))))

View file

@ -111,7 +111,7 @@ If the exit status is non-zero, log the command output and re-throw."
(apply 'vc-git-command t 0 nil args)
(t (message "Error running Git: %s" err)
(message "(buffer-string:\n%s\n)" (buffer-string))
(signal (car err) (cdr err))))
(signal err)))
(buffer-string)))
(defun vc-git-test--start-branch ()

View file

@ -238,8 +238,7 @@ For backends which don't support it, `vc-not-supported' is signaled."
Catch the `vc-not-supported' error."
`(condition-case err
(funcall ,func ,@args)
(vc-not-supported 'vc-not-supported)
(t (signal (car err) (cdr err)))))
(vc-not-supported 'vc-not-supported)))
(defun vc-test--register (backend)
"Register and unregister a file.

View file

@ -137,8 +137,7 @@ the case)."
;; Errors from `unlock-buffer' should call
;; `userlock--handle-unlock-error' (bug#46397).
(cl-letf (((symbol-function 'userlock--handle-unlock-error)
(lambda (err) (signal (car err) (cdr err)))))
(cl-letf (((symbol-function 'userlock--handle-unlock-error) #'signal))
(should (equal '(file-error "Unlocking file")
(seq-subseq (should-error (unlock-buffer)) 0 2))))))
@ -160,8 +159,7 @@ the case)."
;; File errors from unlocking files should call
;; `userlock--handle-unlock-error' (bug#46397).
(cl-letf (((symbol-function 'yes-or-no-p) #'always)
((symbol-function 'userlock--handle-unlock-error)
(lambda (err) (signal (car err) (cdr err)))))
((symbol-function 'userlock--handle-unlock-error) #'signal))
(should (equal '(file-error "Unlocking file")
(seq-subseq (should-error (kill-buffer)) 0 2))))))

View file

@ -546,7 +546,7 @@ See Bug#30460."
;; all `file-error' signals.
(and ,message
(not (string-equal (caddr ,err) ,message))
(signal (car ,err) (cdr ,err))))))))
(signal ,err)))))))
(defmacro process-tests--with-buffers (var &rest body)
"Bind VAR to nil and evaluate BODY.