User: stephent
Date: 06/06/24 16:30:40
Modified: xemacs/tests/automated mule-tests.el region-tests.el
tag-tests.el test-harness.el
Log:
Silence commands that set marks etc in test suite.
<87wtb67hm2.fsf(a)tleepslib.sk.tsukuba.ac.jp>
Revision Changes Path
1.82 +7 -0 XEmacs/xemacs/tests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/ChangeLog,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -p -r1.81 -r1.82
--- ChangeLog 2006/06/24 13:50:19 1.81
+++ ChangeLog 2006/06/24 14:30:36 1.82
@@ -1,5 +1,12 @@
2006-06-24 Stephen J. Turnbull <stephen(a)xemacs.org>
+ * automated/test-harness.el (Silence-Message): New macro.
+ * automated/mule-tests.el: Use it.
+ * automated/region-tests.el: Use it.
+ * automated/tag-tests.el: Use it.
+
+2006-06-24 Stephen J. Turnbull <stephen(a)xemacs.org>
+
* automated/test-harness.el: Improve handling of unexpected errors.
2006-06-03 Aidan Kehoe <kehoea(a)parhasard.net>
1.10 +11 -11 XEmacs/xemacs/tests/automated/mule-tests.el
Index: mule-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/mule-tests.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- mule-tests.el 2006/06/03 17:51:06 1.9
+++ mule-tests.el 2006/06/24 14:30:39 1.10
@@ -340,18 +340,18 @@ This is a naive implementation in Lisp.
'iso-8859-2))
)
;; This is how you suppress output from `message', called by `write-region'
- (flet ((append-message (&rest args) ()))
- (Assert (not (equal name1 name2)))
- (Assert (not (file-exists-p name1)))
- (write-region (point-min) (point-max) name1)
- (Assert (file-exists-p name1))
- (when (fboundp 'make-symbolic-link)
- (make-symbolic-link name1 name2)
- (Assert (file-exists-p name2))
- (Assert (equal (file-truename name2) name1))
- (Assert (equal (file-truename name1) name1)))
+ (Assert (not (equal name1 name2)))
+ (Assert (not (file-exists-p name1)))
+ (Silence-Message
+ (write-region (point-min) (point-max) name1))
+ (Assert (file-exists-p name1))
+ (when (fboundp 'make-symbolic-link)
+ (make-symbolic-link name1 name2)
+ (Assert (file-exists-p name2))
+ (Assert (equal (file-truename name2) name1))
+ (Assert (equal (file-truename name1) name1)))
- (ignore-file-errors (delete-file name1) (delete-file name2))))
+ (ignore-file-errors (delete-file name1) (delete-file name2)))
;; Add many more file operation tests here...
1.2 +8 -4 XEmacs/xemacs/tests/automated/region-tests.el
Index: region-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/region-tests.el,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- region-tests.el 2005/02/24 23:02:37 1.1
+++ region-tests.el 2006/06/24 14:30:39 1.2
@@ -43,10 +43,12 @@
;; Using active regions
(let ((zmacs-regions t)
(first-buffer (current-buffer)))
- (insert (buffer-name))
+ (Silence-Message
+ (insert (buffer-name)))
(Assert (not (region-exists-p)))
(Assert (not (region-active-p)))
- (mark-whole-buffer)
+ (Silence-Message
+ (mark-whole-buffer))
(Assert (region-exists-p))
(Assert (region-active-p))
;; Turn off active regions
@@ -62,7 +64,8 @@
;; Region is active again
(Assert (region-active-p))
(with-temp-buffer
- (insert (buffer-name))
+ (Silence-Message
+ (insert (buffer-name)))
;; Region exists in first buffer, not this second one
(Assert (not (region-exists-p)))
;; Region not active in this second temp buffer
@@ -70,7 +73,8 @@
;; Region still active in first temp buffer
(Assert (eq (zmacs-region-buffer) first-buffer))
;; Activate region in second temp buffer
- (mark-whole-buffer)
+ (Silence-Message
+ (mark-whole-buffer))
;; Region exists in second temp buffer
(Assert (region-exists-p))
;; Region active in second temp buffer
1.4 +6 -3 XEmacs/xemacs/tests/automated/tag-tests.el
Index: tag-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/tag-tests.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- tag-tests.el 2004/05/13 16:41:27 1.3
+++ tag-tests.el 2006/06/24 14:30:39 1.4
@@ -68,20 +68,23 @@ If FILENAME is omitted, the printname of
(let ((tags-always-exact t))
;; Search for the tag "mystruct"; this should succeed
- (find-tag "mystruct")
+ (Silence-Message
+ (find-tag "mystruct"))
(Assert (eq (point) 2))
;; Search again. The search should fail, based on the patch that
;; Sven Grundmann submitted for 21.4.16.
(Check-Error-Message error "No more entries matching mystruct"
- (tags-loop-continue)))
+ (Silence-Message
+ (tags-loop-continue))))
(let ((tags-always-exact nil))
;; Search for the definition of "require". Until the etags.el upgrade
;; from 21.5 in 21.4.16, this test would fail.
(condition-case nil
- (find-tag "require")
+ (Silence-Message
+ (find-tag "require"))
(t t))
(Assert (eq (point) 52)))
1.22 +13 -1 XEmacs/xemacs/tests/automated/test-harness.el
Index: test-harness.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/test-harness.el,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -p -r1.21 -r1.22
--- test-harness.el 2006/06/24 13:50:23 1.21
+++ test-harness.el 2006/06/24 14:30:39 1.22
@@ -38,6 +38,14 @@
;;; Implementation-Incomplete-Expect-Failure wrapper macros to mark them.
;;; A lot of the tests we run push limits; suppress Ebola message with the
;;; Ignore-Ebola wrapper macro.
+;;; Some noisy code will call `message'. Output from `message' can be
+;;; suppressed with the Silence-Message macro. Functions that are known to
+;;; issue messages include `write-region', `find-tag', `tag-loop-continue',
+;;; `insert', and `mark-whole-buffer'. N.B. The Silence-Message macro
+;;; currently does not suppress the newlines printed by `message'.
+;;; Definitely do not use Silence-Message with Check-Message.
+;;; In general it should probably only be used on code that prepares for a
+;;; test, not on tests.
;;;
;;; You run the tests using M-x test-emacs-test-file,
;;; or $(EMACS) -batch -l .../test-harness.el -f batch-test-emacs file ...
@@ -291,7 +299,7 @@ BODY is a sequence of expressions and ma
,quoted-body ',expected-error error-info)
(incf wrong-error-failures)))))
-
+ ;; Do not use this with Silence-Message.
(defmacro Check-Message (expected-message-regexp &rest body)
(Skip-Test-Unless (fboundp 'defadvice)
"can't defadvice"
@@ -322,6 +330,10 @@ BODY is a sequence of expressions and ma
,quoted-body error-info)
(incf other-failures)))
(ad-unadvise 'message)))))
+
+ ;; #### Perhaps this should override `message' itself, too?
+ (defmacro Silence-Message (&rest body)
+ `(flet ((append-message (&rest args) ())) ,@body))
(defmacro Ignore-Ebola (&rest body)
`(let ((debug-issue-ebola-notices -42)) ,@body))
Show replies by date