comparison tests/automated/test-harness.el @ 3472:43b4a54fbf66

[xemacs-hg @ 2006-06-24 14:30:36 by stephent] Silence commands that set marks etc in test suite. <87wtb67hm2.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Sat, 24 Jun 2006 14:30:39 +0000
parents 3b1f8220a65e
children 3660d327399f
comparison
equal deleted inserted replaced
3471:3b1f8220a65e 3472:43b4a54fbf66
36 ;;; Don't suppress tests just because they're due to known bugs not yet 36 ;;; Don't suppress tests just because they're due to known bugs not yet
37 ;;; fixed -- use the Known-Bug-Expect-Failure and 37 ;;; fixed -- use the Known-Bug-Expect-Failure and
38 ;;; Implementation-Incomplete-Expect-Failure wrapper macros to mark them. 38 ;;; Implementation-Incomplete-Expect-Failure wrapper macros to mark them.
39 ;;; A lot of the tests we run push limits; suppress Ebola message with the 39 ;;; A lot of the tests we run push limits; suppress Ebola message with the
40 ;;; Ignore-Ebola wrapper macro. 40 ;;; Ignore-Ebola wrapper macro.
41 ;;; Some noisy code will call `message'. Output from `message' can be
42 ;;; suppressed with the Silence-Message macro. Functions that are known to
43 ;;; issue messages include `write-region', `find-tag', `tag-loop-continue',
44 ;;; `insert', and `mark-whole-buffer'. N.B. The Silence-Message macro
45 ;;; currently does not suppress the newlines printed by `message'.
46 ;;; Definitely do not use Silence-Message with Check-Message.
47 ;;; In general it should probably only be used on code that prepares for a
48 ;;; test, not on tests.
41 ;;; 49 ;;;
42 ;;; You run the tests using M-x test-emacs-test-file, 50 ;;; You run the tests using M-x test-emacs-test-file,
43 ;;; or $(EMACS) -batch -l .../test-harness.el -f batch-test-emacs file ... 51 ;;; or $(EMACS) -batch -l .../test-harness.el -f batch-test-emacs file ...
44 ;;; which is run for you by the `make check' target in the top-level Makefile. 52 ;;; which is run for you by the `make check' target in the top-level Makefile.
45 53
289 (error 297 (error
290 (Print-Failure "%S ==> expected error %S, got error %S instead" 298 (Print-Failure "%S ==> expected error %S, got error %S instead"
291 ,quoted-body ',expected-error error-info) 299 ,quoted-body ',expected-error error-info)
292 (incf wrong-error-failures))))) 300 (incf wrong-error-failures)))))
293 301
294 302 ;; Do not use this with Silence-Message.
295 (defmacro Check-Message (expected-message-regexp &rest body) 303 (defmacro Check-Message (expected-message-regexp &rest body)
296 (Skip-Test-Unless (fboundp 'defadvice) 304 (Skip-Test-Unless (fboundp 'defadvice)
297 "can't defadvice" 305 "can't defadvice"
298 expected-message-regexp 306 expected-message-regexp
299 (let ((quoted-body (if (= 1 (length body)) 307 (let ((quoted-body (if (= 1 (length body))
320 (error 328 (error
321 (Print-Failure "%S ==> unexpected error %S" 329 (Print-Failure "%S ==> unexpected error %S"
322 ,quoted-body error-info) 330 ,quoted-body error-info)
323 (incf other-failures))) 331 (incf other-failures)))
324 (ad-unadvise 'message))))) 332 (ad-unadvise 'message)))))
333
334 ;; #### Perhaps this should override `message' itself, too?
335 (defmacro Silence-Message (&rest body)
336 `(flet ((append-message (&rest args) ())) ,@body))
325 337
326 (defmacro Ignore-Ebola (&rest body) 338 (defmacro Ignore-Ebola (&rest body)
327 `(let ((debug-issue-ebola-notices -42)) ,@body)) 339 `(let ((debug-issue-ebola-notices -42)) ,@body))
328 340
329 (defun Int-to-Marker (pos) 341 (defun Int-to-Marker (pos)