I can run Christian's xmtn-tests.el on Windows; they all pass except
two that deal with non-ascii stuff. I'll leave fixing those for later;
I've never tried to deal with non-ascii encodings.
I highly recommend writing tests like this; it makes changing code
much less dangerous.
I'm duplicating some of the tests for bzr, and I've run into a
problem.
The structure of a test is:
(defsuite bzr-one
(log
(save-window-excursion
(bzr-tests--with-test-history (&key &allow-other-keys)
;; The test is simply that this doesn't crash.
(dvc-log)
(sleep-for 2); let log display
(dvc-revlist-show-item))))
)
'defsuite' is defined in elunit.el (I'll check that in later); it
creates a list of tests to run.
bzr-tests--with-test-history creates a new workspace, inits it,
inserts a simple file, adds and commits it, edits it, commits again. So
there's something for dvc-log to display.
The problem I'm having is that the log doesn't actually display until
Emacs returns to the top level; dvc-revlist-show-item fails because
there's no text in the *bzr-log* buffer, so it can't find the current
item in the ewoc cookie.
sleep-for is supposed to do a redisplay, but there's still no data.
For example, if I just run:
(defun bzr-test-one ()
(let ((default-directory bzr-test-dir))
(dvc-log)
(sleep-for 2)
(redisplay t)
(message "display 1 point max %d" (point-max))
(sleep-for 2)
(redisplay t)
(message "display 2 point max %d" (point-max))
(sleep-for 2)
))
I get:
running process `"bzr" "--no-aliases" "log"' in <path>
display 1 point max 3
display 2 point max 3
The equivalent test works in xmtn-tests; the difference is that
xmtn-dvc-log runs xmtn synchronously to generate the log, while
bzr-dvc-log runs bzr asynchronously.
So apparently the Emacs top level lets async tasks complete, while
sleep-for and (redisplay t) don't.
Does anyone know how to wait so that aysnc tasks complete?
Or maybe we need some sort of 'testing' flag that tells
dvc-run-dvc-async to actually be synchronous. That would avoid race
conditions in general in the tests.
--
-- Stephe
_______________________________________________
Dvc-dev mailing list
[email protected]
https://mail.gna.org/listinfo/dvc-dev