From f0c474e659b81da0d2ab75e7ec109355965f7a1c Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Thu, 16 Dec 2021 12:03:18 +0800 Subject: [PATCH] test-org-element: Add new tests for org-element-cache * testing/lisp/test-org-element.el (test-org-element/cache): Add tests for edits near :end of an element. --- testing/lisp/test-org-element.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 54ca7405f..0f66d6cdf 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -4068,6 +4068,22 @@ Text (should (eq 'example-block (org-element-type (org-element-at-point)))) (re-search-forward "END_") (org-element-type (org-element-at-point)))))) + ;; Test edits near :end of element + (should-not (eq 'headline + (org-test-with-temp-text "* H1\nP1\n*H2\n" + (org-element-cache-map #'ignore :granularity 'element) + (insert "Blah") + (org-element-type (org-element-at-point))))) + (should-not (eq 'headline + (org-test-with-temp-text "* H1\nP1\n*H2\n" + (org-element-cache-map #'ignore :granularity 'element) + (backward-delete-char 1) + (org-element-type (org-element-at-point))))) + (should (eq 'headline + (org-test-with-temp-text "* H1\nP1\n