aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-pearl-bugfixes.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test-pearl-bugfixes.el b/tests/test-pearl-bugfixes.el
index c1348f1..3d8d53e 100644
--- a/tests/test-pearl-bugfixes.el
+++ b/tests/test-pearl-bugfixes.el
@@ -150,5 +150,28 @@
(should-error (pearl-run-local-view "bad") :type 'user-error)
(should-not fetched))))
+;;; Bug: an out-of-range priority cookie ([#E]) silently downgraded to None
+
+(ert-deftest test-pearl-priority-number-in-range ()
+ "A/B/C/D cookies map to Linear 1-4; a heading with no cookie is 0 (None)."
+ (test-pearl-bug--in-org "* TODO [#A] Urgent issue\n"
+ (should (= 1 (pearl--priority-number-at-point))))
+ (test-pearl-bug--in-org "* TODO [#C] Medium issue\n"
+ (should (= 3 (pearl--priority-number-at-point))))
+ (test-pearl-bug--in-org "* TODO [#D] Low issue\n"
+ (should (= 4 (pearl--priority-number-at-point))))
+ (test-pearl-bug--in-org "* TODO No cookie issue\n"
+ (should (= 0 (pearl--priority-number-at-point)))))
+
+(ert-deftest test-pearl-priority-number-out-of-range-errors ()
+ "An out-of-range cookie ([#E]) signals a user-error, not a silent None.
+The old reader matched only [#A-D], so [#E] fell through to 0 and a save
+silently pushed None, clearing the issue's Linear priority. Now it refuses
+at read time so the bad cookie surfaces before any push."
+ (test-pearl-bug--in-org "* TODO [#E] Bogus priority\n"
+ (should-error (pearl--priority-number-at-point) :type 'user-error))
+ (test-pearl-bug--in-org "* TODO [#Z] Also bogus\n"
+ (should-error (pearl--priority-number-at-point) :type 'user-error)))
+
(provide 'test-pearl-bugfixes)
;;; test-pearl-bugfixes.el ends here