emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5


From: Jens Schmidt
Subject: Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
Date: Thu, 24 Aug 2023 14:48:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

On 2023-08-24  14:24, Ihor Radchenko wrote:
> Jens Schmidt <jschmidt4gnu@vodafonemail.de> writes:
> 
>> Would you mind if I added a test that explicitly and with some nice
>> error message tests for that condition?  I.e. if some unwary user
>> strips off trailing whitespace in test-org.el, that test would fail
>> with a reasonable message.
> 
> There is no universal rule when and when not to add trailing spaces in
> the tests.

Not sure what you mean by that, but some tests rely on trailing spaces
and fail when these are not present.  An explicit test on that would
make the issue more visible.  See below for what I mean.  The only (?)
downside is that this catches such errors in test-org.el only, and not
in all the other tests, many of which also contain (on purpose or
inadvertently) trailing whitespace:

[org-mode]$ grep -l $'[ \t]$' testing/lisp/*
testing/lisp/test-ob-C.el
testing/lisp/test-ob-R.el
testing/lisp/test-ob-fortran.el
testing/lisp/test-org-agenda.el
testing/lisp/test-org-element.el
testing/lisp/test-org-fold.el
testing/lisp/test-org-footnote.el
testing/lisp/test-org.el


----------------------------------------
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index e33f500a3..e49c2f957 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -9363,6 +9363,16 @@ two
                                (string-match-p "\\`Invalid format.*%2" 
err-text))
                     err)))))
 
+

+;;; Meta-test on Trailing Whitespace not Being Deleted
+
+(ert-deftest test-org/trailing-whitespace-deleted ()
+    "Ensure trailing whitespace did not get deleted in this file."
+  (should
+   (equal "Do not delete trailing whitespace --> 
+           in this file."
+          "Do not delete trailing whitespace --> \n           in this file.")))
+
 (provide 'test-org)
 
 ;;; test-org.el ends here
----------------------------------------

If the blank after the arrow gets removed, this test fails as:

----------------------------------------
Test test-org/trailing-whitespace-deleted condition:
    (ert-test-failed
     ((should
       (equal "Do not delete trailing whitespace -->
           in this file." "Do not delete trailing whitespace --> 
           in this file."))
      :form
      (equal "Do not delete trailing whitespace -->
           in this file." "Do not delete trailing whitespace --> 
           in this file.")
      :value nil :explanation
      (arrays-of-different-length 62 63 "Do not delete trailing whitespace -->
           in this file." "Do not delete trailing whitespace --> 
           in this file." first-mismatch-at 37)))
   FAILED  1068/1095  test-org/trailing-whitespace-deleted (0.000193 sec)

[...]

1 unexpected results:
   FAILED  test-org/trailing-whitespace-deleted
----------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]