emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
@ 2023-08-24 11:31 Jens Schmidt
  2023-08-24 11:41 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Schmidt @ 2023-08-24 11:31 UTC (permalink / raw)
  To: Org-mode

Seems the insert-heading-issue is still struggling, this time during
a "make check" @ d5ee33fed8dd80d3f9f9811d86a73827fde80780 using Emacs 29:

Test test-org/insert-heading condition:
    (ert-test-failed
     ((should
       (equal "* 1\n** 1.1\n** 1.2\n*\n* 2"
	      (org-test-with-temp-text "<point>* 1\n** 1.1\n** 1.2\n* 2" ... ...)))
      :form
      (equal "* 1\n** 1.1\n** 1.2\n*\n* 2"
	     #("* 1\n** 1.1\n** 1.2\n* \n* 2" 0 2
	       (face org-level-1)
	       2 3
	       (face org-level-1)
	       4 5
	       (face org-level-2)
	       5 7
	       (face org-level-2)
	       7 10
	       (face org-level-2)
	       11 12
	       (face org-level-2)
	       12 14
	       (face org-level-2)
	       14 17
	       (face org-level-2)
	       21 23
	       (face org-level-1)
	       23 24
	       (face org-level-1)))
      :value nil :explanation
      (arrays-of-different-length 23 24 "* 1\n** 1.1\n** 1.2\n*\n* 2"
				  #("* 1\n** 1.1\n** 1.2\n* \n* 2" 0 2
				    (face org-level-1)
				    2 3
				    (face org-level-1)
				    4 5
				    (face org-level-2)
				    5 7
				    (face org-level-2)
				    7 10
				    (face org-level-2)
				    11 12
				    (face org-level-2)
				    12 14
				    (face org-level-2)
				    14 17
				    (face org-level-2)
				    21 23
				    (face org-level-1)
				    23 24
				    (face org-level-1))
				  first-mismatch-at 19)))
   FAILED   998/1094  test-org/insert-heading (0.018306 sec) at ../lisp/test-org.el:1845


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-24 11:41 UTC (permalink / raw)
  To: Jens Schmidt; +Cc: Org-mode

Jens Schmidt <jschmidt4gnu@vodafonemail.de> writes:

> Seems the insert-heading-issue is still struggling, this time during
> a "make check" @ d5ee33fed8dd80d3f9f9811d86a73827fde80780 using Emacs 29:
> ...
>    FAILED   998/1094  test-org/insert-heading (0.018306 sec) at ../lisp/test-org.el:1845

I cannot reproduce on my system. Using Emacs 29.
Our CI tests are also not failing.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
  2023-08-24 11:41 ` Ihor Radchenko
@ 2023-08-24 12:08   ` Jens Schmidt
  2023-08-24 12:24     ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Schmidt @ 2023-08-24 12:08 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-mode

On 2023-08-24  13:41, Ihor Radchenko wrote:
> Jens Schmidt <jschmidt4gnu@vodafonemail.de> writes:
> 
>> Seems the insert-heading-issue is still struggling, this time during
>> a "make check" @ d5ee33fed8dd80d3f9f9811d86a73827fde80780 using Emacs 29:
>> ...
>>    FAILED   998/1094  test-org/insert-heading (0.018306 sec) at ../lisp/test-org.el:1845
> 
> I cannot reproduce on my system. Using Emacs 29.
> Our CI tests are also not failing.

Not a bug, my bad:  I keep forgetting about `delete-trailing-whitespace'
on my `before-save-hook'.

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.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
  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
  0 siblings, 2 replies; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-24 12:24 UTC (permalink / raw)
  To: Jens Schmidt; +Cc: Org-mode

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.

What we can do is setting `delete-trailing-lines' to nil in tests - via
directory-local variable.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
  2023-08-24 12:24     ` Ihor Radchenko
@ 2023-08-24 12:25       ` Ihor Radchenko
  2023-08-24 12:48       ` Jens Schmidt
  1 sibling, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-24 12:25 UTC (permalink / raw)
  To: Jens Schmidt; +Cc: Org-mode

Ihor Radchenko <yantar92@posteo.net> writes:

> What we can do is setting `delete-trailing-lines' to nil in tests - via
> directory-local variable.

Never mind. This will not affect deleting empty lines that are not
at the end of buffer.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
  2023-08-24 12:24     ` Ihor Radchenko
  2023-08-24 12:25       ` Ihor Radchenko
@ 2023-08-24 12:48       ` Jens Schmidt
  2023-08-25  7:56         ` Ihor Radchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Jens Schmidt @ 2023-08-24 12:48 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-mode

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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [BUG] "make check" reports a failure on test-org/insert-heading @ d5ee33f (this time with Emacs 29)
  2023-08-24 12:48       ` Jens Schmidt
@ 2023-08-25  7:56         ` Ihor Radchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2023-08-25  7:56 UTC (permalink / raw)
  To: Jens Schmidt; +Cc: Org-mode

Jens Schmidt <jschmidt4gnu@vodafonemail.de> writes:

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

That's what I mean. For some tests, we do want trailing whitespace. For
some - not. Imagine that we decide to change the test failing due to
whitespace cleanup, but leave your proposed test. Then, your test may be
failing, and it will be rather difficult to figure out why.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-25  7:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-08-25  7:56         ` Ihor Radchenko

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