diff options
| author | Michael Albinus | 2025-02-03 12:51:48 +0100 |
|---|---|---|
| committer | Michael Albinus | 2025-02-03 12:51:48 +0100 |
| commit | fbc13ba9ccf4590ccd15dafa35d3872807af9cbd (patch) | |
| tree | 16668bf7fabab8892a7bb4feee448e395b9181eb | |
| parent | a7f34a532cf7d99dac58bd7187f7ad82c1e4d789 (diff) | |
| download | emacs-fbc13ba9ccf4590ccd15dafa35d3872807af9cbd.tar.gz emacs-fbc13ba9ccf4590ccd15dafa35d3872807af9cbd.zip | |
Better NaN handling in proced-tests.el
* test/lisp/proced-tests.el (proced--cpu-at-point): Make it more robust.
(proced--assert-process-valid-cpu-refinement):
Handle `ert-test-skipped' signal.
| -rw-r--r-- | test/lisp/proced-tests.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el index e24163c3884..ecf23c5d037 100644 --- a/test/lisp/proced-tests.el +++ b/test/lisp/proced-tests.el | |||
| @@ -38,10 +38,10 @@ | |||
| 38 | (defun proced--cpu-at-point () | 38 | (defun proced--cpu-at-point () |
| 39 | "Return as an integer the current CPU value at point." | 39 | "Return as an integer the current CPU value at point." |
| 40 | (if (string-suffix-p "nan" (thing-at-point 'sexp)) | 40 | (if (string-suffix-p "nan" (thing-at-point 'sexp)) |
| 41 | (let ((pid (proced-pid-at-point))) | 41 | (ert-skip |
| 42 | (ert-skip | 42 | (format |
| 43 | (format | 43 | "Found NaN value for %%CPU at point for process with PID %s" |
| 44 | "Found NaN value for %%CPU at point for process with PID %d" pid))) | 44 | (substring-no-properties (thing-at-point 'sexp)))) |
| 45 | (thing-at-point 'number))) | 45 | (thing-at-point 'number))) |
| 46 | 46 | ||
| 47 | (defun proced--assert-emacs-pid-in-buffer () | 47 | (defun proced--assert-emacs-pid-in-buffer () |
| @@ -61,6 +61,7 @@ | |||
| 61 | (proced--move-to-column "%CPU") | 61 | (proced--move-to-column "%CPU") |
| 62 | (condition-case err | 62 | (condition-case err |
| 63 | (>= (proced--cpu-at-point) cpu) | 63 | (>= (proced--cpu-at-point) cpu) |
| 64 | (ert-test-skipped (signal (car err) (cdr err))) | ||
| 64 | (error | 65 | (error |
| 65 | (ert-fail | 66 | (ert-fail |
| 66 | (list err (proced--assert-process-valid-cpu-refinement-explainer cpu)))))) | 67 | (list err (proced--assert-process-valid-cpu-refinement-explainer cpu)))))) |