moved old instructions for external packages to top-level in preparation for nuking...
[CommonLispStat.git] / external / lift.darcs / _darcs / pristine / dev / lift-notes.lisp
blob942320766aeac99224ee61f9b518275a5985d4f1
1 (in-package #:lift)
3 If a test suite isn't defined and try to define a test for it, you get an odd error instead
5 #|
6 testsuite-setup
7 testsuite-run
8 testsuite-teardown
10 testsuite-run
11 run each method of this suite using run-test-internal
12 run child suites
14 run-test-internal
15 start-test
16 setup-test
17 funcall test-method
18 teardown-test
19 end-test
22 ;; sharing test code
23 (defmethod testsuite-run ((case test-with-generators) (result test-result))
24 (loop for generators do
25 (set-generators)
26 (run-testsuite case result)))
29 ;; single setup
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*
44 in deftestsuite:
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
57 better message
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
71 simplify parsers
73 what should number-of-tests really do
76 Lift:
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))
87 :single-setup)
90 (addtest
91 test-1
94 (addtest
95 test-2
98 (deftestsuite foo-1 (big-setup)
101 (addtest
102 test-1-1
105 (addtest
106 test-1-2
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 ;;; ---------------------------------------------------------------------------
114 (deftestsuite foo ()
115 (<vars>)
116 (:cases ...)
117 (:setup ))
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)))
136 (:test
137 (insert-item queue 2)
138 (insert-item queue 4)
139 (dequeue queue)
140 (dequeue queue)
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)
152 (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)
158 (dequeue queue)
159 (dequeue queue)
160 (ensure-error (dequeue queue)))
162 ;;; ---------------------------------------------------------------------------
165 ;;; full factorial
166 (deftestsuite test-queue-error-when-empty (test-queue)
167 (q1 q2 q3 q4)
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))))
179 ;;; as pairs
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
185 (deftestsuite foo ()
186 ((number :foreach '(1 2 3 4 5 6))))
188 ;;;; pros
189 ;; simple syntax (so far!)
192 ;;;; Cons
193 ;; conses up a list of prototypes instead of mapping them
194 ;; (I think that supporting mapping would create big changes in LIFT).
197 ;;;; Unknowns
198 ;; what will this implement as?
200 ;;; ---------------------------------------------------------------------------
201 ;;; another way to handle setup for 'sequencial' tests
202 ;;; ---------------------------------------------------------------------------