A few random genesis cleanups
[sbcl.git] / contrib / sb-introspect / xref-test.lisp
blob7675344278840ad1091c165a8b7487e29418fe18
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package :sb-introspect-test/xref)
12 (defmacro define-xref-test (name form result)
13 `(deftest ,name
14 (sort (mapcar #'first ,form) #'string< :key #'princ-to-string)
15 ,(sort (copy-list result) #'string< :key #'princ-to-string)))
17 (define-xref-test who-calls.1
18 (who-calls 'foo)
19 nil)
20 (define-xref-test who-calls.2
21 (who-calls 'bar)
22 (xref/1 xref/3))
24 (define-xref-test who-calls.3
25 (who-calls 'xref/1)
26 (xref/2))
28 (define-xref-test who-calls.4
29 (who-calls 'xref/2)
30 (xref/5
31 xref/6
32 xref/8
33 xref/8
34 xref/12
35 (sb-pcl::fast-method xref/10 (t t t t t t t t fixnum))
36 (sb-pcl::fast-method xref/11 (fixnum))
37 (sb-pcl::fast-method xref/11 ((eql z)))))
39 (define-xref-test who-calls.5
40 (who-calls 'xref/3)
41 (inline/1 (sb-pcl::fast-method xref/11 (float))))
43 (define-xref-test who-calls.6
44 (who-calls 'xref/4)
45 nil)
47 (define-xref-test who-calls.7
48 (who-calls 'xref/5)
49 nil)
51 (define-xref-test who-calls.8
52 (who-calls 'xref/6)
53 (xref/7))
55 (define-xref-test who-calls.9
56 (who-calls 'xref/7)
57 nil)
59 (define-xref-test who-calls.10
60 (who-calls 'xref/8)
61 nil)
63 (define-xref-test who-calls.11
64 (who-calls 'xref/10)
65 nil)
66 (define-xref-test who-calls.12
67 (who-calls 'xref/11)
68 nil)
70 (define-xref-test who-calls.13
71 (who-calls 'inline/1)
72 (xref/12))
74 (define-xref-test who-calls.14
75 (who-calls 'xref/12)
76 (macro/1))
78 (define-xref-test who-calls.15
79 (who-calls 'inline/3)
80 (inline/3-user/1
81 inline/3-user/2
82 inline/3-user/3
83 inline/3-user/4))
85 (define-xref-test who-calls.16
86 (who-calls 'inline/4)
87 (inline/4-user))
89 (define-xref-test who-calls.17
90 (who-calls 'called-by-traced-fun)
91 (traced-fun))
93 #+sb-eval
94 (define-xref-test who-calls.18
95 (who-calls 'called-by-interpreted-fun)
96 nil)
99 (define-xref-test who-macroexpands.1
100 (who-macroexpands 'macro/1)
101 (macro-use/1
102 macro-use/2
103 macro-use/3
104 macro-use/4
105 inline/2))
108 (define-xref-test who-binds.1
109 (who-binds '*a*)
110 (xref/2))
113 (define-xref-test who-sets.1
114 (who-sets '*a*)
115 (xref/2 xref/13))
117 (define-xref-test who-sets.2
118 (who-sets '**global**)
119 (xref/16))
121 (define-xref-test who-references.1
122 (who-references '*a*)
123 (xref/1 xref/2 xref/4 inline/1 xref/14))
125 (define-xref-test who-references.2
126 (who-references '+z+)
127 (inline/1))
129 (define-xref-test who-references.3
130 (who-references '**global**)
131 (xref/15))
133 (define-xref-test who-calls.struct-slot.1
134 (who-calls 'struct-slot)
135 (source-user))
137 (define-xref-test who-calls.cmacro.1
138 (who-calls 'cmacro)
139 (source-user))
142 (define-xref-test who-specializes-directly.1
143 (who-specializes-directly 'a-class)
144 ((method a-gf-1)
145 (method a-gf-2)))
147 (define-xref-test who-specializes-directly.2
148 (who-specializes-directly 'a-structure)
149 ((method a-gf-1)
150 (method a-gf-2)))
152 (define-xref-test who-specializes-generally.1
153 (who-specializes-generally 'a-class)
154 ((method a-gf-1)
155 (method a-gf-2)
156 (method a-gf-3)))
158 (define-xref-test who-specializes-generally.2
159 (who-specializes-generally 'a-structure)
160 ((method a-gf-1)
161 (method a-gf-2)
162 (method a-gf-3)))