unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Some testing issues
@ 2017-07-07 21:22 Stephen Berman
  2017-07-08  4:20 ` Noam Postavsky
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Stephen Berman @ 2017-07-07 21:22 UTC (permalink / raw)
  To: emacs-devel

I installed some new tests for todo-mode.el in master c24748a and there
were a few problems that I don't understand; maybe someone here can
enlighten me.

Several of the tests call the function todo-toggle-view-done-items,
which contains this code:

	  (if (not (pos-visible-in-window-p shown))
	      (recenter)

(`shown' stores the position of the first done item in the category, if
it is shown.)  When using todo-mode and also when stepping through the
function with Edebug, it works as expected.  But when running the tests,
sometimes -- but not always -- it fails with the error "`recenter'ing a
window that does not display current-buffer."  In those cases, the test
failure is prevented by evaluating the following sexp immediately before
calling todo-toggle-view-done-items:

          (set-window-buffer nil (current-buffer))

When using todo-mode this is not necessary, because the selected window
always contains the current buffer when the function is called, but
apparently when running the tests, this isn't always the case, although
according to Edebug it is, AFAICT.  And again, the failure only happens
in some cases, though in those, it is reliably reproducible.  In
addition, in at least one case, when I rerun the test immediately after
it fails, then it succeeds.  And lastly, in one case, the test succeeds
without the set-window-buffer call when run interactively, but fails
without it when run in batch mode from the shell.  Any idea what's going
on here?  (If anyone wants to take a closer look, comments in the test
file point out the problematic cases.)

A second problem concerns trying to reference a message in a test.  The
function todo-toggle-view-done-items outputs a message if the category
contains no done items, and the test captures this by calling
current-message immediately after todo-toggle-view-done-items.  This
works when running the test interactively, but in a batch run,
current-message is nil (though the message is output in the shell).
Why?  (I avoid the failure in batch mode by testing a different but
effectively equivalent condition.)

Finally, one of the tests involves a display overlay that hides the item
header, which as a consequence, when using todo-mode, prevented the
cursor from appearing where the code put point, resulting in a display
bug.  I fixed this (in master 264dd81) by moving point to the first
visible position after the overlay.  But when running the test, the
overlay evidently does not inhibit point, but since the test, following
the bugfix code in todo-mode.el, assumes it does, it fails.  It seems
that the test environment does not reflect the same display mechanisms
that using the code does.  I haven't found a solution or workaround for
this, so the test is currently marked ":expected-result :failed".  I
hope someone can come up with a better alternative.

I'd be grateful for any suggestions or advice.

Steve Berman



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

end of thread, other threads:[~2017-07-17 18:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-07 21:22 Some testing issues Stephen Berman
2017-07-08  4:20 ` Noam Postavsky
2017-07-08 14:50   ` Stephen Berman
2017-07-08 22:01     ` Noam Postavsky
2017-07-14  9:55       ` Stephen Berman
2017-07-08  4:45 ` Stefan Monnier
2017-07-08 14:52   ` Stephen Berman
2017-07-10 17:33     ` Stefan Monnier
2017-07-14  9:56       ` Stephen Berman
2017-07-14 13:44         ` Stefan Monnier
2017-07-17 10:02           ` Stephen Berman
2017-07-17 18:22             ` Stefan Monnier
2017-07-08  7:18 ` martin rudalics
2017-07-08 14:51   ` Stephen Berman
2017-07-09  7:46     ` martin rudalics
2017-07-14  9:55       ` Stephen Berman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).