comparison lisp/test-harness.el @ 5130:4f4672e2aa34 ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Sun, 07 Mar 2010 06:20:19 -0600
parents b24cf478a45e
children 0f66906b6e37
comparison
equal deleted inserted replaced
5129:ebd8cab8629f 5130:4f4672e2aa34
192 (setq filename buffer-file-name))) 192 (setq filename buffer-file-name)))
193 (test-harness-from-buffer input-buffer filename) 193 (test-harness-from-buffer input-buffer filename)
194 (kill-buffer input-buffer) 194 (kill-buffer input-buffer)
195 )) 195 ))
196 196
197 (defsubst test-harness-backtrace ()
198 "Display a reasonable-size backtrace."
199 (let ((print-escape-newlines t)
200 (print-length 50))
201 (backtrace nil t)))
202
197 (defsubst test-harness-assertion-failure-do-debug (error-info) 203 (defsubst test-harness-assertion-failure-do-debug (error-info)
198 "Maybe enter debugger or display a backtrace on assertion failure. 204 "Maybe enter debugger or display a backtrace on assertion failure.
199 ERROR-INFO is a cons of the args (SIG . DATA) that were passed to `signal'. 205 ERROR-INFO is a cons of the args (SIG . DATA) that were passed to `signal'.
200 The debugger will be entered if noninteractive and 206 The debugger will be entered if noninteractive and
201 `test-harness-unexpected-error-enter-debugger' is non-nil; else, a 207 `test-harness-unexpected-error-enter-debugger' is non-nil; else, a
204 (when (not test-harness-bug-expected) 210 (when (not test-harness-bug-expected)
205 (cond ((and (not noninteractive) 211 (cond ((and (not noninteractive)
206 test-harness-assertion-failure-enter-debugger) 212 test-harness-assertion-failure-enter-debugger)
207 (funcall debugger 'error error-info)) 213 (funcall debugger 'error error-info))
208 (test-harness-assertion-failure-show-backtrace 214 (test-harness-assertion-failure-show-backtrace
209 (backtrace nil t))))) 215 (test-harness-backtrace)))))
210 216
211 (defsubst test-harness-unexpected-error-do-debug (error-info) 217 (defsubst test-harness-unexpected-error-do-debug (error-info)
212 "Maybe enter debugger or display a backtrace on unexpected error. 218 "Maybe enter debugger or display a backtrace on unexpected error.
213 ERROR-INFO is a cons of the args (SIG . DATA) that were passed to `signal'. 219 ERROR-INFO is a cons of the args (SIG . DATA) that were passed to `signal'.
214 The debugger will be entered if noninteractive and 220 The debugger will be entered if noninteractive and
218 (when (not test-harness-bug-expected) 224 (when (not test-harness-bug-expected)
219 (cond ((and (not noninteractive) 225 (cond ((and (not noninteractive)
220 test-harness-unexpected-error-enter-debugger) 226 test-harness-unexpected-error-enter-debugger)
221 (funcall debugger 'error error-info)) 227 (funcall debugger 'error error-info))
222 (test-harness-unexpected-error-show-backtrace 228 (test-harness-unexpected-error-show-backtrace
223 (backtrace nil t))))) 229 (test-harness-backtrace)))))
224 230
225 (defsubst test-harness-unexpected-error-condition-handler (error-info context-msg) 231 (defsubst test-harness-unexpected-error-condition-handler (error-info context-msg)
226 "Condition handler for when unexpected errors occur. 232 "Condition handler for when unexpected errors occur.
227 Useful in conjunction with `call-with-condition-handler'. ERROR-INFO is the 233 Useful in conjunction with `call-with-condition-handler'. ERROR-INFO is the
228 value passed to the condition handler. CONTEXT-MSG is a string indicating 234 value passed to the condition handler. CONTEXT-MSG is a string indicating