emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Org-mode <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <c982aed3-15de-7fdb-3658-505222dbc65a@vodafonemail.de> (raw)
In-Reply-To: <87y1i01vci.fsf@localhost>

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
----------------------------------------



  parent reply	other threads:[~2023-08-24 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 11:31 [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29) Jens Schmidt
2023-08-24 11:41 ` Ihor Radchenko
2023-08-24 12:08   ` Jens Schmidt
2023-08-24 12:24     ` Ihor Radchenko
2023-08-24 12:25       ` Ihor Radchenko
2023-08-24 12:48       ` Jens Schmidt [this message]
2023-08-25  7:56         ` 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=c982aed3-15de-7fdb-3658-505222dbc65a@vodafonemail.de \
    --to=jschmidt4gnu@vodafonemail.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).