3 If a test suite isn
't defined and try to define a test for it
, you get an odd error instead
11 run each method of this suite using run-test-internal
23 (defmethod testsuite-run ((case test-with-generators
) (result test-result
))
24 (loop for generators do
26 (run-testsuite case result
)))
31 My first thought
(and attempt
) was to have the test-suite do the setup for
32 single-setup? tests. This sort of works but gets wonky when a superclass has
33 it
's own setup. It also doesn
't make it easy to support making setup optional
35 My zeroth thought was to have a switch that each test checked.
42 ok - test-teardown needs to remove vars from
*test-environment
*
45 ;; create class first so that we can introspec on it
46 ;;?? this is kind of weak
48 make sure that we have all the methods we need for
49 generator tests
, single setup tests
, tests with timeout
51 could probably get rid of
(need to have something that grabs super-classes then
):
52 (defun test-slot-names (test-name)
53 (mopu-class-slot-names test-name
))
55 custom error messages as conditions
58 > Error
: Failed assertion
: (TEST-CLASS-P CLASS
)
59 > While executing
: CCL
::%ASSERTION-FAILURE
60 > Type Command-
/ to continue
, Command-. to abort.
61 > If continued
: test the assertion again.
63 a describe for test-mixins
65 make run-tests-internal a method
66 make run-tests to the work
67 possibly change
*current-test-class
* to a symbol always
69 make run-test a function
, see above
73 what should number-of-tests really do
78 ;;; ---------------------------------------------------------------------------
79 ;;; sharing setup and teardown
80 ;;; ---------------------------------------------------------------------------
82 ;;;; currently, LIFT always shuffles cases within each class
84 (deftestsuite big-setup
()
85 (:setup
(long-slow-process))
86 (:teardown
(some-clean-up))
98 (deftestsuite foo-1
(big-setup)
109 ;;; ---------------------------------------------------------------------------
110 ;;; want to use the same test on different things. So we need to have
111 ;;; the same test body with different setup
112 ;;; ---------------------------------------------------------------------------
121 (subclasses* 'containers
::abstract-queue
)
123 (#<STANDARD-CLASS ABSTRACT-QUEUE
> #<STANDARD-CLASS PRIORITY-QUEUE-HEAP
>
124 #<STANDARD-CLASS RING-BUFFER
> #<STANDARD-CLASS BASIC-QUEUE
>
125 #<STANDARD-CLASS PRIORITY-QUEUE-ON-CONTAINER
>)
127 No easy way to get
, e.g.
, all the PQOCs b
/c we don
't know
(and can
't easily know
)
128 which containers it can be on. Could add protocol.
130 (deftestsuite test-queue
() ())
132 ;;; ---------------------------------------------------------------------------
134 (deftestsuite test-queue-error-when-empty
(test-queue)
135 ((queue (make-container 'basic-queue
)))
137 (insert-item queue
2)
138 (insert-item queue
4)
141 (ensure-error (dequeue queue
))))
143 ;;; ---------------------------------------------------------------------------
145 (deftestsuite test-queue-error-when-empty
(test-queue)
146 ((queue (make-container 'basic-queue
))))
148 (deftestsuite test-queue-error-when-empty
(test-queue)
149 ((queue :foreach
(prototype-of 'abstract-queue
))))
151 (deftestsuite test-queue-error-when-empty
(test-queue)
153 (:cases
(queue (prototype-of 'abstract-queue
))))
155 (addtest (test-queue-error-when-empty)
156 (insert-item queue
2)
157 (insert-item queue
4)
160 (ensure-error (dequeue queue
)))
162 ;;; ---------------------------------------------------------------------------
166 (deftestsuite test-queue-error-when-empty
(test-queue)
168 (:cases
(queue-1 :foreach
(prototype-of 'abstract-queue
))
169 (queue-2 :foreach
(prototype-of 'abstract-queue
))))
171 (deftestsuite test-queue-error-when-empty
(test-queue)
172 ((queue-1 :foreach
(prototype-of 'abstract-queue
))
173 (queue-2 :foreach
(prototype-of 'abstract-queue
))))
175 (deftestsuite test-queue-error-when-empty
(test-queue)
176 ((queue-1 :foreach
(prototype-of 'abstract-queue
))
177 (queue-2 :foreach
(prototype-of 'abstract-queue
))))
180 (deftestsuite test-queue-error-when-empty
(test-queue)
181 ((queue-1 :foreach
(prototype-of 'abstract-queue
))
182 (queue-2 :andeach
(prototype-of 'abstract-queue
))))
184 ;;; any generator will do
186 ((number :foreach
'(1 2 3 4 5 6))))
189 ;; simple syntax (so far!)
193 ;; conses up a list of prototypes instead of mapping them
194 ;; (I think that supporting mapping would create big changes in LIFT).
198 ;; what will this implement as?
200 ;;; ---------------------------------------------------------------------------
201 ;;; another way to handle setup for 'sequencial' tests
202 ;;; ---------------------------------------------------------------------------