diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-merge.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/test-pearl-merge.el b/tests/test-pearl-merge.el index 711e772..931849d 100644 --- a/tests/test-pearl-merge.el +++ b/tests/test-pearl-merge.el @@ -178,10 +178,12 @@ Merge must protect any locally-edited field, not only the description." ;;; touched-markers + per-subtree fold (ert-deftest test-pearl-merge-returns-touched-markers-for-updated-and-added () - "The merge result carries one marker per re-rendered or appended subtree. -The marker list is the foundation of the per-subtree fold path that -replaced the global re-fold: callers fold just the touched subtrees so -an edit-then-merge flow leaves the rest of the page (and point) alone." + "The merge result carries one marker per re-rendered or appended subtree, +and each marker lands on the CORRECT heading (not the next subtree). +A previous bug: the alist marker is insertion-type t (correct for +later subtrees), so reusing it captured the post-replace advance and +folded the wrong subtree. The fix copies the marker as type-nil +before the replace so it stays anchored to the heading." (test-pearl-merge--in-org (test-pearl-merge--buffer (test-pearl-merge--issue "a" "Alpha" "Desc.") (test-pearl-merge--issue "b" "Beta" "Desc.")) @@ -192,16 +194,16 @@ an edit-then-merge flow leaves the rest of the page (and point) alone." (markers (plist-get counts :touched-markers))) ;; 2 updated + 1 added = 3 markers (should (= 3 (length markers))) - ;; Every marker points at a live position in this buffer - (dolist (m markers) - (should (markerp m)) - (should (eq (current-buffer) (marker-buffer m)))) - ;; Each marker sits on or before an issue heading - (dolist (m markers) - (save-excursion - (goto-char m) - (org-back-to-heading t) - (should (org-entry-get nil "LINEAR-ID"))))))) + ;; Resolve each marker to the LINEAR-ID at its heading. The set must + ;; match exactly {a, b, c}: a and b were updated, c was added. + (let ((ids (mapcar (lambda (m) + (save-excursion + (goto-char m) + (org-back-to-heading t) + (org-entry-get nil "LINEAR-ID"))) + markers))) + (should (equal (sort (copy-sequence ids) #'string<) + '("a" "b" "c"))))))) (ert-deftest test-pearl-merge-skipped-issues-do-not-add-to-touched-markers () "A locally-edited subtree the merge kept (skipped) is not in :touched-markers. |
