aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-pearl-adhoc.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test-pearl-adhoc.el b/tests/test-pearl-adhoc.el
index 23aad79..d8c7231 100644
--- a/tests/test-pearl-adhoc.el
+++ b/tests/test-pearl-adhoc.el
@@ -28,6 +28,35 @@
(require 'test-bootstrap (expand-file-name "test-bootstrap.el"))
(require 'cl-lib)
+;;; --filter-none sentinel helpers
+
+(ert-deftest test-pearl-filter-none-value-p-recognizes-sentinel ()
+ "The sentinel string reads as a `no constraint' value."
+ (should (pearl--filter-none-value-p pearl--filter-none)))
+
+(ert-deftest test-pearl-filter-none-value-p-recognizes-empty-and-nil ()
+ "Empty input and nil also read as `no constraint' (for back-compat)."
+ (should (pearl--filter-none-value-p ""))
+ (should (pearl--filter-none-value-p nil)))
+
+(ert-deftest test-pearl-filter-none-value-p-rejects-real-values ()
+ "An actual picked value does not read as `no constraint'."
+ (should-not (pearl--filter-none-value-p "In Progress"))
+ (should-not (pearl--filter-none-value-p "Platform"))
+ (should-not (pearl--filter-none-value-p "bug")))
+
+(ert-deftest test-pearl-with-none-prepends-sentinel ()
+ "`pearl--with-none' puts the sentinel first so it sits at the top of the
+completing-read candidate list."
+ (let ((wrapped (pearl--with-none '("alpha" "beta"))))
+ (should (string= pearl--filter-none (car wrapped)))
+ (should (equal '("alpha" "beta") (cdr wrapped)))))
+
+(ert-deftest test-pearl-with-none-empty-list-yields-just-the-sentinel ()
+ "An empty candidate list still yields a one-element list with the sentinel."
+ (let ((wrapped (pearl--with-none '())))
+ (should (equal (list pearl--filter-none) wrapped))))
+
;;; --assemble-filter
(ert-deftest test-pearl-assemble-filter-only-set-keys ()