diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-output.el | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-pearl-output.el b/tests/test-pearl-output.el index 79b7a82..f9f66eb 100644 --- a/tests/test-pearl-output.el +++ b/tests/test-pearl-output.el @@ -103,6 +103,38 @@ (org-mode) (should-error (pearl-refresh-current-view) :type 'user-error))) +;;; malformed / unknown source headers + +(ert-deftest test-pearl-read-active-source-malformed-is-nil () + "A syntactically malformed #+LINEAR-SOURCE: line reads back nil, not a reader error." + (with-temp-buffer + (insert "#+title: x\n#+LINEAR-SOURCE: (:type filter :filter (:assignee\n\n") + (should-not (pearl--read-active-source)))) + +(ert-deftest test-pearl-refresh-current-view-malformed-source-errors () + "A malformed source header surfaces the no-source user error, not a reader error." + (with-temp-buffer + (insert "#+title: x\n#+LINEAR-SOURCE: (:type filter :filter (:assignee\n") + (org-mode) + (should-error (pearl-refresh-current-view) :type 'user-error))) + +(ert-deftest test-pearl-refresh-current-view-unknown-type-errors () + "A source with a valid but unknown :type signals the unknown-type user error." + (with-temp-buffer + (insert (format "#+title: x\n#+LINEAR-SOURCE: %s\n" + (prin1-to-string '(:type bogus :name "x")))) + (org-mode) + (should-error (pearl-refresh-current-view) :type 'user-error))) + +(ert-deftest test-pearl-source-header-roundtrips-special-chars () + "A source name/filter with quotes, parens, colons, and non-ASCII round-trips." + (let ((source '(:type filter + :name "Bugs: \"urgent\" (P1) — café" + :filter (:labels ("a:b" "(paren)" "naïve"))))) + (with-temp-buffer + (insert (pearl--build-org-content '() source)) + (should (equal source (pearl--read-active-source)))))) + ;;; --update-org-from-issues surfaces the result (ert-deftest test-pearl-update-org-surfaces-fresh-buffer () |
