diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-list-comments.el | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test-pearl-list-comments.el b/tests/test-pearl-list-comments.el index 751e220..71d3e73 100644 --- a/tests/test-pearl-list-comments.el +++ b/tests/test-pearl-list-comments.el @@ -112,6 +112,32 @@ (let ((out (pearl--format-comments (test-pearl--comments 2)))) (should (string-match-p "^\\*\\*\\* Comments$" out)))) +(ert-deftest test-pearl-format-comments-nests-under-issue-level () + "The Comments subtree nests one level under the issue: a flat issue (level 2, +the default) gets Comments at level 3 and bodies at level 4; a grouped issue at +level 3 gets Comments at level 4 and bodies at level 5. Regression guard for +the grouping bug where comments rendered as siblings of their issue." + (let ((comments (test-pearl--comments 1))) + ;; flat (default level 2) + (should (string-match-p "^\\*\\*\\* Comments$" (pearl--format-comments comments nil 2))) + (should (string-match-p "^\\*\\*\\*\\* " (pearl--format-comments comments nil 2))) + ;; grouped (issue at level 3) + (let ((out (pearl--format-comments comments nil 3))) + (should (string-match-p "^\\*\\*\\*\\* Comments$" out)) + (should (string-match-p "^\\*\\*\\*\\*\\* " out)) + (should-not (string-match-p "^\\*\\*\\* Comments$" out))))) + +(ert-deftest test-pearl-format-issue-grouped-nests-comments-under-issue () + "A level-3 issue with comments renders its Comments subtree at level 4 (a +child), not level 3 (a sibling) -- the grouped-view regression." + (let* ((issue (list :id "u" :identifier "ENG-1" :title "Fix it" + :priority 2 :state '(:name "Todo") + :comments (test-pearl--comments 1))) + (out (pearl--format-issue-as-org-entry issue 3))) + (should (string-match-p "^\\*\\*\\* TODO " out)) ; issue at level 3 + (should (string-match-p "^\\*\\*\\*\\* Comments$" out)) ; Comments nested at 4 + (should-not (string-match-p "^\\*\\*\\* Comments$" out)))) + ;;; the marked heading is still found by the append locator (ert-deftest test-pearl-append-finds-marked-comments-heading () |
