From: Ihor Radchenko <yantar92@gmail.com> To: Bastien <bzg@gnu.org> Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Fix test-org-element/cache Date: Sat, 15 May 2021 20:31:19 +0800 [thread overview] Message-ID: <87wns0mb54.fsf@localhost> (raw) In-Reply-To: <87v97kfc4x.fsf@gnu.org> [-- Attachment #1: Type: text/plain, Size: 233 bytes --] Bastien <bzg@gnu.org> writes: > Applied in maint, thanks! The patch also revealed an idea for another test. The new test is revealing existing bug on master. Attached is the patch adding the test with ":expected-result :failed". [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Add-a-test-for-known-bug-in-org-element-cache.patch --] [-- Type: text/x-diff, Size: 1899 bytes --] From d3a5a606c64ed1da0d1880f503c2461839dbfec9 Mon Sep 17 00:00:00 2001 Message-Id: <d3a5a606c64ed1da0d1880f503c2461839dbfec9.1621081760.git.yantar92@gmail.com> From: Ihor Radchenko <yantar92@gmail.com> Date: Sat, 15 May 2021 20:27:20 +0800 Subject: [PATCH] Add a test for known bug in org-element-cache * testing/lisp/test-org-element.el (test-org-element/cache-bugs): A new test documenting a known bug: 1. Create initial file like: P0 P1 | a | b | <point>| c | d | Note that second line of the table is not indented. Now, org-element-at-point returns table-row. 2. Modify the file to test org-element-cache P0 - item P1 | a | b | <point>| c | d | Now, the first (indented) row of the table belongs to item. The second row should be an individual table and org-element-at-point returns table. --- testing/lisp/test-org-element.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 28e9ecd12..18991b5bc 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -3889,6 +3889,21 @@ (ert-deftest test-org-element/cache () :end (org-element-property :parent (org-element-at-point))) (+ parent-end 3)))))) +(ert-deftest test-org-element/cache-bugs () + "Test basic expectations and common pitfalls for cache." + :expected-result :failed + ;; Unindented second row of the table should not be re-parented by + ;; inserted item. + (should + (eq 'table + (let ((org-element-use-cache t)) + (org-test-with-temp-text + "#+begin_center\nP0\n\n<point>\n\n P1\n | a | b |\n| c | d |\n#+end_center" + (save-excursion (search-forward "| c |") (org-element-at-point)) + (insert "- item") + (search-forward "| c |") + (beginning-of-line) + (org-element-type (org-element-at-point))))))) (provide 'test-org-element) -- 2.26.3
next prev parent reply other threads:[~2021-05-15 12:27 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-15 11:38 Ihor Radchenko 2021-05-15 11:51 ` Bastien 2021-05-15 12:31 ` Ihor Radchenko [this message] 2021-05-15 12:34 ` Bastien 2021-05-15 12:04 ` Nicolas Goaziou 2021-05-15 12:21 ` Ihor Radchenko 2021-05-15 12:33 ` Ihor Radchenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87wns0mb54.fsf@localhost \ --to=yantar92@gmail.com \ --cc=bzg@gnu.org \ --cc=emacs-orgmode@gnu.org \ --subject='Re: [PATCH] Fix test-org-element/cache' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).