aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-27 14:01:18 -0500
committerCraig Jennings <c@cjennings.net>2026-05-27 14:01:18 -0500
commitaf6b923cba0149aadc22a738c77462e1b3c907d3 (patch)
tree9dcea0d3a133125d9cfdd10b1aa2a608eddf94f6
parentbb78d88be0382db8e0f946c0175897c37159f0d7 (diff)
downloadorg-drill-af6b923cba0149aadc22a738c77462e1b3c907d3.tar.gz
org-drill-af6b923cba0149aadc22a738c77462e1b3c907d3.zip
fix: guard sm2 cl-assert error tests behind Emacs-30 skip
The three error-case tests in test-org-drill-determine-next-interval-sm2.el asserted their cl-assert preconditions with a bare should-error :type 'cl-assertion-failed. On Emacs 29, ERT installs a signal-hook that keeps should-error from matching the condition, so the tests failed the 29.4 job outright. Under undercover's edebug instrumentation the same assert dropped into a blocking debugger in batch mode, which hung the coverage job until the 6-hour timeout on every push. The sm5 and simple8 files already wrap their equivalent error tests in a skip-unless guard for this quirk. I copied that helper into sm2 so all three scheduler files handle Emacs 29 the same way.
-rw-r--r--tests/test-org-drill-determine-next-interval-sm2.el29
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/test-org-drill-determine-next-interval-sm2.el b/tests/test-org-drill-determine-next-interval-sm2.el
index 3bf5cf3..8405968 100644
--- a/tests/test-org-drill-determine-next-interval-sm2.el
+++ b/tests/test-org-drill-determine-next-interval-sm2.el
@@ -422,21 +422,38 @@ Simulates inconsistent learning."
;; The function asserts (> n 0) and (and (>= quality 0) (<= quality 5)).
;; n is normalized from 0 to 1 first, so only a negative n trips its assert.
+(defmacro test-scheduler--should-cl-assert (&rest body)
+ "Assert BODY signals a cl-assertion-failed.
+
+Mirrors the sm5 and simple8 files' helper — see their commentary
+for the ERT-29 signal-hook quirk that forces a `skip-unless' on
+Emacs <30. Under undercover's edebug instrumentation the same
+quirk drops into a blocking debugger in batch mode, so a bare
+`should-error' here would hang the coverage job rather than fail."
+ `(progn
+ (skip-unless (>= emacs-major-version 30))
+ (let ((caught
+ (condition-case _err
+ (progn ,@body 'no-error)
+ (cl-assertion-failed 'caught))))
+ (unless (eq caught 'caught)
+ (ert-fail "expected cl-assertion-failed signal, got none")))))
+
(ert-deftest test-org-drill-determine-next-interval-sm2-error-quality-above-max ()
"Quality above the 0-5 range trips the quality assertion."
- (should-error (org-drill-determine-next-interval-sm2 1 2 2.5 6 0 4.0 1)
- :type 'cl-assertion-failed))
+ (test-scheduler--should-cl-assert
+ (org-drill-determine-next-interval-sm2 1 2 2.5 6 0 4.0 1)))
(ert-deftest test-org-drill-determine-next-interval-sm2-error-quality-below-min ()
"Quality below the 0-5 range trips the quality assertion."
- (should-error (org-drill-determine-next-interval-sm2 1 2 2.5 -1 0 4.0 1)
- :type 'cl-assertion-failed))
+ (test-scheduler--should-cl-assert
+ (org-drill-determine-next-interval-sm2 1 2 2.5 -1 0 4.0 1)))
(ert-deftest test-org-drill-determine-next-interval-sm2-error-negative-n ()
"A negative repeat count trips the (> n 0) assertion. Note n=0 is
normalized to 1 before the assert, so zero is not an error case."
- (should-error (org-drill-determine-next-interval-sm2 1 -1 2.5 4 0 4.0 1)
- :type 'cl-assertion-failed))
+ (test-scheduler--should-cl-assert
+ (org-drill-determine-next-interval-sm2 1 -1 2.5 4 0 4.0 1)))
(provide 'test-org-drill-determine-next-interval-sm2)
;;; test-org-drill-determine-next-interval-sm2.el ends here