diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-26 15:06:42 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-26 15:06:42 -0500 |
| commit | 02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3 (patch) | |
| tree | 40e2d12dfede9e93423a3fc163229a8d453fe265 /tests/test-pearl-mapping.el | |
| parent | 41a33964c6b97858a17fd12288592b03d5df68d9 (diff) | |
| download | pearl-02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3.tar.gz pearl-02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3.zip | |
refactor: remove the dead state-to-todo mapping subsystem
`pearl-state-to-todo-mapping` and its derived regex stopped doing real work once keyword rendering moved to slugifying the Linear state name (`pearl--state-name-to-keyword`) and the keyword-to-state direction moved to resolving through the team's workflow states. The defcustom fed only `pearl--get-todo-states-pattern`, which had no caller left, and the two cache vars existed only to serve that dead function. State extraction reads `org-get-todo-state` off the buffer's `#+TODO` line, so nothing live touched the mapping.
I removed the defcustom, both cache vars, and the dead function, and dropped the three pattern tests that exercised it. Removing the defcustom orphaned the mapping bindings that ~12 test setup macros still carried. They were passing through slugification rather than the map, so I stripped them too and kept the `org-todo-keywords` bindings the temp buffers actually need. Also dropped the stale README config row.
Diffstat (limited to 'tests/test-pearl-mapping.el')
| -rw-r--r-- | tests/test-pearl-mapping.el | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/tests/test-pearl-mapping.el b/tests/test-pearl-mapping.el index b5faa3d..1207bf0 100644 --- a/tests/test-pearl-mapping.el +++ b/tests/test-pearl-mapping.el @@ -20,56 +20,17 @@ ;;; Commentary: ;; Unit tests for the pure mapping helpers in pearl.el: -;; Linear state <-> org keyword, the cached TODO-states regex, and -;; Linear priority -> org cookie / readable name. +;; Linear priority -> org cookie / readable name, and the priority list. ;;; Code: (require 'test-bootstrap (expand-file-name "test-bootstrap.el")) -;; A small, explicit mapping used across the state tests so cases don't -;; depend on the package default. -(defmacro test-pearl--with-mapping (mapping &rest body) - "Run BODY with the state mapping bound to MAPPING and the cache cleared." - (declare (indent 1)) - `(let ((pearl-state-to-todo-mapping ,mapping) - (pearl-todo-states-pattern nil) - (pearl--todo-states-pattern-source nil)) - ,@body)) - -;; pearl--map-linear-state-to-org (the static name->keyword lookup) was removed -;; in the keyword-cycle save: the keyword is now always the slug of the state -;; name (`pearl--state-name-to-keyword'), matching the workspace-derived #+TODO -;; header, and the keyword->state-id direction resolves through the team's -;; states (`pearl--resolve-keyword-to-state'), not a flat mapping. The mapping -;; alist itself survives only as the source for `pearl--get-todo-states-pattern' -;; (tested below). - -;;; pearl--get-todo-states-pattern - -(ert-deftest test-pearl-get-todo-states-pattern-builds-alternation () - "The pattern is the org keywords joined with regex alternation." - (test-pearl--with-mapping '(("Todo" . "TODO") ("In Progress" . "IN-PROGRESS") ("Done" . "DONE")) - (should (string-equal "TODO\\|IN-PROGRESS\\|DONE" - (pearl--get-todo-states-pattern))))) - -(ert-deftest test-pearl-get-todo-states-pattern-empty-mapping () - "An empty mapping yields an empty pattern string." - (test-pearl--with-mapping '() - (should (string-equal "" (pearl--get-todo-states-pattern))))) - -(ert-deftest test-pearl-get-todo-states-pattern-recomputes-after-mapping-change () - "The cached pattern is recomputed when the mapping changes mid-session. - -Regression for the stale-cache bug: a once-populated pattern must not -outlive a change to `pearl-state-to-todo-mapping'." - (test-pearl--with-mapping '(("Todo" . "TODO") ("Done" . "DONE")) - (should (string-equal "TODO\\|DONE" (pearl--get-todo-states-pattern))) - ;; Change the mapping after the pattern has been cached. - (setq pearl-state-to-todo-mapping - '(("Todo" . "TODO") ("In Progress" . "DOING") ("Done" . "DONE"))) - (should (string-equal "TODO\\|DOING\\|DONE" - (pearl--get-todo-states-pattern))))) +;; The static Linear-state -> Org-keyword mapping and its derived regex were +;; removed once keyword rendering moved to slugifying the state name +;; (`pearl--state-name-to-keyword'), and the keyword -> state-id direction moved +;; to resolving through the team's states (`pearl--resolve-keyword-to-state'). +;; What remains pure-mapping-shaped is the priority conversion, tested below. ;;; pearl--map-linear-priority-to-org |
