aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-reverse-compile.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-01 23:40:11 -0500
committerCraig Jennings <c@cjennings.net>2026-06-01 23:40:11 -0500
commit8bae955521cdf3e2f8d5ff015b3ae36b5b8a75e8 (patch)
tree2d765a0aba944e0af418f0dbf736e10d07eef73d /tests/test-pearl-reverse-compile.el
parent5ef986c880fa6fdfafe3f11943524119065bd044 (diff)
downloadpearl-8bae955521cdf3e2f8d5ff015b3ae36b5b8a75e8.tar.gz
pearl-8bae955521cdf3e2f8d5ff015b3ae36b5b8a75e8.zip
feat(filter): :state accepts a list of state names
I made :state polymorphic, mirroring :state-type. A string still compiles to state.name.eq. A list now compiles to state.name.in, so (:state ("Todo" "In Review")) matches issues in either state. The reverse-compile inverts state.name.in back to a scalar (one name) or a list (several), so copy-down no longer refuses a Linear view filtering on a set of named states. The validator accepts a string or a list of non-empty names, the same shape it already enforces for :labels, and a list-valued :state keeps its precedence over :state-type and :open. Phase 1 of docs/multi-state-filter-spec.org. Suite, compile, and lint green.
Diffstat (limited to 'tests/test-pearl-reverse-compile.el')
-rw-r--r--tests/test-pearl-reverse-compile.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test-pearl-reverse-compile.el b/tests/test-pearl-reverse-compile.el
index ec67391..382c72a 100644
--- a/tests/test-pearl-reverse-compile.el
+++ b/tests/test-pearl-reverse-compile.el
@@ -57,6 +57,24 @@
(ert-deftest test-pearl-rc-roundtrip-state-name ()
(test-pearl-rc--should-roundtrip '(:state "In Progress")))
+(ert-deftest test-pearl-rc-roundtrip-state-name-list ()
+ "A multi-state :state round-trips (state.name.in with several names)."
+ (let ((r (test-pearl-rc--roundtrip '(:state ("Todo" "In Review")))))
+ (should (eq 'ok (car r)))
+ (should (equal (cdr r) '(:state ("Todo" "In Review"))))))
+
+(ert-deftest test-pearl-rc-state-name-in-many-to-list ()
+ "state.name.in with several names reverse-compiles to a list :state."
+ (should (equal (test-pearl-rc--from-json
+ "{\"state\":{\"name\":{\"in\":[\"Todo\",\"In Review\"]}}}")
+ '(ok :state ("Todo" "In Review")))))
+
+(ert-deftest test-pearl-rc-state-name-in-one-to-scalar ()
+ "state.name.in with one name normalizes to a scalar :state."
+ (should (equal (test-pearl-rc--from-json
+ "{\"state\":{\"name\":{\"in\":[\"Todo\"]}}}")
+ '(ok :state "Todo"))))
+
(ert-deftest test-pearl-rc-roundtrip-state-type-single ()
(let ((r (test-pearl-rc--roundtrip '(:state-type "started"))))
(should (eq 'ok (car r)))