source: trunk/source/tests/ansi-tests/invoke-debugger.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Fri Feb 28 21:59:57 2003
4;;;; Contains: Tests of INVOKE-DEBUGGER
5
6(in-package :cl-test)
7
8;;; We can't test actual entry into the debugger, but we can test
9;;; that the function in *debugger-hook* is properly called.
10
11(deftest invoke-debugger.1
12  (block done
13   (let (fn (cnd (make-condition 'simple-error)))
14       (setq fn #'(lambda (c hook)
15                    (return-from done
16                      (and (null *debugger-hook*)
17                           (eqt hook fn)
18                           (eqt cnd c)
19                           'good))))
20       (let ((*debugger-hook* fn))
21         (invoke-debugger cnd)))
22   'bad)
23  good)
24
25(deftest invoke-debugger.error.1
26  (signals-error
27   (block done
28     (let ((*debugger-hook* #'(lambda (&rest args)
29                                (declare (ignore args))
30                                (return-from done 'bad))))
31       (invoke-debugger)))
32   program-error)
33  t)
34
35(deftest invoke-debugger.error.2
36  (signals-error
37   (block done
38     (let ((*debugger-hook* #'(lambda (&rest args)
39                                (declare (ignore args))
40                                (return-from done 'bad))))
41       (invoke-debugger (make-condition 'simple-error) nil)))
42   program-error)
43  t)
44
45;;; If the debugger hook function expects the wrong number
46;;; of arguments, a program-error should be thrown in safe code
47;;; This error is thrown 'prior to entry to the standard debugger'.
48
49(deftest invoke-debugger.error.3
50  (signals-error
51   (let ((*debugger-hook* #'(lambda () nil)))
52     (invoke-debugger (make-condition 'simple-error)))
53   program-error)
54  t)
55
56(deftest invoke-debugger.error.4
57  (signals-error
58   (let ((*debugger-hook* #'(lambda (c) c)))
59     (invoke-debugger (make-condition 'simple-error)))
60   program-error)
61  t)
62
63(deftest invoke-debugger.error.5
64  (signals-error
65   (let ((*debugger-hook* #'(lambda (c hook x) (list c hook x))))
66     (invoke-debugger (make-condition 'simple-error)))
67   program-error)
68  t)
Note: See TracBrowser for help on using the repository browser.