1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; While most of SBCL is derived from the CMU CL system, the test
5 ;;;; files (like this one) were written from scratch after the fork
8 ;;;; This software is in the public domain and is provided with
9 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
10 ;;;; more information.
15 (defmacro assert-condition-source-paths
(form &rest source-paths
)
16 `(assert (equal (checked-compile-condition-source-paths
18 (mapcar (lambda (path)
22 (defmacro warning-signalling-macro
(&body body
)
23 (warn "warning from macro")
26 (defmacro error-signalling-macro
(&body body
)
27 (declare (ignore body
))
28 (error "error from macro"))
33 (with-test (:name
(:source-path multiple-value-bind
))
34 (assert-condition-source-paths
35 (multiple-value-bind (1 2) (list 1 2))
38 (with-test (:name
(:source-path multiple-value-setq
))
39 (assert-condition-source-paths
40 (multiple-value-setq (1 2) (list 1 2))
43 (with-test (:name
(:source-path cond
))
44 (assert-condition-source-paths (cond 1) (1))
45 (assert-condition-source-paths (cond #()) (1))
46 (assert-condition-source-paths (cond "foo") (1))
47 (assert-condition-source-paths (cond (t t
) 1) (2)))
49 (with-test (:name
(:source-path do
))
50 (assert-condition-source-paths (do () 1) ())
51 (assert-condition-source-paths (do 1 (t)) ()) ; should be improved
52 (assert-condition-source-paths (do (1) (t)) (1))
53 (assert-condition-source-paths (do (x (1)) (t)) (1 1)))
55 (with-test (:name
(:source-path do
*))
56 (assert-condition-source-paths (do* () 1) ())
57 (assert-condition-source-paths (do* 1 (t)) ()) ; should be improved
58 (assert-condition-source-paths (do* (1) (t)) (1))
59 (assert-condition-source-paths (do* (x (1)) (t)) (1 1)))
61 (with-test (:name
(:source-path dolist
))
62 (assert-condition-source-paths (dolist (x (1 .
2))) (1 1)))
64 (with-test (:name
(:source-path restart-bind
))
65 (assert-condition-source-paths (restart-bind ((continue (lambda ()) 1))) (0 1))
66 (assert-condition-source-paths (restart-bind ((nil (lambda ()) 1))) (0 1)))
68 (with-test (:name
(:source-path restart-case
))
69 (assert-condition-source-paths (restart-case 1 (1)) (2))
70 (assert-condition-source-paths (restart-case 1 (continue 1)) (2)))
72 (with-test (:name
(:source-path handler-bind
))
73 (assert-condition-source-paths (handler-bind (1)) (1))
74 (assert-condition-source-paths
75 (handler-bind ((error (lambda (c) (declare (ignore c
))) 1)))
78 ;; Not sure what's going on with this one.
79 #+nil
(assert-condition-source-paths
80 (handler-bind ((no-such-type #'continue
)))
83 (with-test (:name
(:source-path handler-case
))
84 (assert-condition-source-paths (handler-case 1 (error)) (2)))
86 (with-test (:name
(:source-path case
))
87 (assert-condition-source-paths (case 1 1) (2))
88 (assert-condition-source-paths (case 1 (a :a
) 1) (3))
89 (assert-condition-source-paths (case 1 (a :a
) (a :b
)) (3))
90 (assert-condition-source-paths (case 1 (t :a
) (b :b
)) (2)))
92 (with-test (:name
(:source-path declare
))
93 (assert-condition-source-paths (declare (1)) (1))
94 (assert-condition-source-paths (declare (type integer
) (1)) (2)))
96 (defclass deprecated-class
() ())
97 (declaim (deprecated :early
"1.0" (type deprecated-class
)))
98 (defgeneric using-deprecated
(thing))
99 (with-test (:name
(:source-path defmethod
deprecated :specializer
))
100 (assert-condition-source-paths
101 (defmethod using-deprecated ((thing deprecated-class
)))
104 (with-test (:name
(:source-path defmethod
:walk-body
))
105 (assert-condition-source-paths
106 (defmethod using-deprecated ((thing t
))
107 (progn (warning-signalling-macro)))
108 (1 3) (1 3)) ; FIXME duplication is an artifact of DEFMETHOD's implementation
109 (assert-condition-source-paths
110 (defmethod using-deprecated ((thing t
))
111 (progn (error-signalling-macro)))