Fix make-array transforms.
[sbcl.git] / contrib / sb-introspect / xref-test.lisp
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.
9
10 (in-package :sb-introspect-test/xref)
11
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)))
16
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))
23
24 (define-xref-test who-calls.3
25     (who-calls 'xref/1)
26   (xref/2))
27
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
38 (define-xref-test who-calls.5
39     (who-calls 'xref/3)
40   (inline/1 (sb-pcl::fast-method xref/11 (float))))
41
42 (define-xref-test who-calls.6
43     (who-calls 'xref/4)
44   nil)
45
46 (define-xref-test who-calls.7
47     (who-calls 'xref/5)
48   nil)
49
50 (define-xref-test who-calls.8
51     (who-calls 'xref/6)
52   (xref/7))
53
54 (define-xref-test who-calls.9
55     (who-calls 'xref/7)
56   nil)
57
58 (define-xref-test who-calls.10
59     (who-calls 'xref/8)
60   nil)
61
62 (define-xref-test who-calls.11
63     (who-calls 'xref/10)
64   nil)
65 (define-xref-test who-calls.12
66     (who-calls 'xref/11)
67   nil)
68
69 (define-xref-test who-calls.13
70     (who-calls 'inline/1)
71   (xref/12))
72
73 (define-xref-test who-calls.14
74     (who-calls 'xref/12)
75   (macro/1))
76
77 (define-xref-test who-calls.15
78     (who-calls 'inline/3)
79   (inline/3-user/1
80    inline/3-user/2
81    inline/3-user/3
82    inline/3-user/4))
83
84 (define-xref-test who-calls.16
85     (who-calls 'inline/4)
86   (inline/4-user))
87
88
89 (define-xref-test who-macroexpands.1
90     (who-macroexpands 'macro/1)
91   (macro-use/1
92    macro-use/2
93    macro-use/3
94    macro-use/4
95    inline/2))
96
97
98 (define-xref-test who-binds.1
99     (who-binds '*a*)
100   (xref/2))
101
102
103 (define-xref-test who-sets.1
104     (who-sets '*a*)
105   (xref/2 xref/13))
106
107
108 (define-xref-test who-references.1
109     (who-references '*a*)
110   (xref/1 xref/2 xref/4 inline/1 xref/14))
111
112 (define-xref-test who-references.2
113     (who-references '+z+)
114   (inline/1))
115
116
117 (define-xref-test who-calls.struct-slot.1
118     (who-calls 'struct-slot)
119   (source-user))
120
121 (define-xref-test who-calls.cmacro.1
122     (who-calls 'cmacro)
123   (source-user))
124
125
126 (define-xref-test who-specializes-directly.1
127     (who-specializes-directly 'a-class)
128   ((method a-gf-1)
129    (method a-gf-2)))
130
131 (define-xref-test who-specializes-directly.2
132     (who-specializes-directly 'a-structure)
133   ((method a-gf-1)
134    (method a-gf-2)))
135
136 (define-xref-test who-specializes-generally.1
137     (who-specializes-generally 'a-class)
138   ((method a-gf-1)
139    (method a-gf-2)
140    (method a-gf-3)))
141
142 (define-xref-test who-specializes-generally.2
143     (who-specializes-generally 'a-structure)
144   ((method a-gf-1)
145    (method a-gf-2)
146    (method a-gf-3)))