clucumber 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data/LICENSE +1 -1
  2. data/README.md +4 -9
  3. data/lib/clucumber/clucumber-bootstrap.lisp +32 -0
  4. data/lib/clucumber/vendor/cl-interpol/alias.lisp +55 -0
  5. data/lib/clucumber/vendor/cl-interpol/cl-interpol.asd +56 -0
  6. data/lib/clucumber/vendor/cl-interpol/load.lisp +53 -0
  7. data/lib/clucumber/vendor/cl-interpol/packages.lisp +40 -0
  8. data/lib/clucumber/vendor/cl-interpol/read.lisp +716 -0
  9. data/lib/clucumber/vendor/cl-interpol/specials.lisp +113 -0
  10. data/lib/clucumber/vendor/cl-interpol/test/packages.lisp +34 -0
  11. data/lib/clucumber/vendor/cl-interpol/test/tests.lisp +128 -0
  12. data/lib/clucumber/vendor/cl-interpol/test.lisp +177 -0
  13. data/lib/clucumber/vendor/cl-interpol/test2.lisp +6254 -0
  14. data/lib/clucumber/vendor/cl-interpol/unicode.lisp +13912 -0
  15. data/lib/clucumber/vendor/cl-interpol/util.lisp +122 -0
  16. data/lib/clucumber/vendor/cl-ppcre/api.lisp +1262 -0
  17. data/lib/clucumber/vendor/cl-ppcre/charmap.lisp +152 -0
  18. data/lib/clucumber/vendor/cl-ppcre/charset.lisp +242 -0
  19. data/lib/clucumber/vendor/cl-ppcre/chartest.lisp +98 -0
  20. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-test.asd +34 -0
  21. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/packages.lisp +38 -0
  22. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/resolver.lisp +61 -0
  23. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode.asd +58 -0
  24. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre.asd +79 -0
  25. data/lib/clucumber/vendor/cl-ppcre/closures.lisp +471 -0
  26. data/lib/clucumber/vendor/cl-ppcre/convert.lisp +875 -0
  27. data/lib/clucumber/vendor/cl-ppcre/errors.lisp +84 -0
  28. data/lib/clucumber/vendor/cl-ppcre/lexer.lisp +737 -0
  29. data/lib/clucumber/vendor/cl-ppcre/lispworks-defsystem.lisp +57 -0
  30. data/lib/clucumber/vendor/cl-ppcre/load.lisp +67 -0
  31. data/lib/clucumber/vendor/cl-ppcre/optimize.lisp +578 -0
  32. data/lib/clucumber/vendor/cl-ppcre/packages.lisp +68 -0
  33. data/lib/clucumber/vendor/cl-ppcre/parser.lisp +319 -0
  34. data/lib/clucumber/vendor/cl-ppcre/ppcre-tests.lisp +269 -0
  35. data/lib/clucumber/vendor/cl-ppcre/regex-class-util.lisp +555 -0
  36. data/lib/clucumber/vendor/cl-ppcre/regex-class.lisp +259 -0
  37. data/lib/clucumber/vendor/cl-ppcre/repetition-closures.lisp +833 -0
  38. data/lib/clucumber/vendor/cl-ppcre/scanner.lisp +506 -0
  39. data/lib/clucumber/vendor/cl-ppcre/specials.lisp +172 -0
  40. data/lib/clucumber/vendor/cl-ppcre/test/packages.lisp +37 -0
  41. data/lib/clucumber/vendor/cl-ppcre/test/perl-tests.lisp +150 -0
  42. data/lib/clucumber/vendor/cl-ppcre/test/tests.lisp +159 -0
  43. data/lib/clucumber/vendor/cl-ppcre/test/unicode-tests.lisp +80 -0
  44. data/lib/clucumber/vendor/cl-ppcre/util.lisp +201 -0
  45. data/lib/clucumber/vendor/cl-unicode/alias.lisp +135 -0
  46. data/lib/clucumber/vendor/cl-unicode/api.lisp +412 -0
  47. data/lib/clucumber/vendor/cl-unicode/build/char-info.lisp +133 -0
  48. data/lib/clucumber/vendor/cl-unicode/build/dump.lisp +239 -0
  49. data/lib/clucumber/vendor/cl-unicode/build/read.lisp +280 -0
  50. data/lib/clucumber/vendor/cl-unicode/build/util.lisp +182 -0
  51. data/lib/clucumber/vendor/cl-unicode/cl-unicode.asd +90 -0
  52. data/lib/clucumber/vendor/cl-unicode/conditions.lisp +54 -0
  53. data/lib/clucumber/vendor/cl-unicode/derived.lisp +120 -0
  54. data/lib/clucumber/vendor/cl-unicode/hash-tables.lisp +20 -0
  55. data/lib/clucumber/vendor/cl-unicode/lists.lisp +10 -0
  56. data/lib/clucumber/vendor/cl-unicode/methods.lisp +15 -0
  57. data/lib/clucumber/vendor/cl-unicode/packages.lisp +76 -0
  58. data/lib/clucumber/vendor/cl-unicode/specials.lisp +135 -0
  59. data/lib/clucumber/vendor/cl-unicode/test/packages.lisp +34 -0
  60. data/lib/clucumber/vendor/cl-unicode/test/tests.lisp +150 -0
  61. data/lib/clucumber/vendor/cl-unicode/test-functions.lisp +94 -0
  62. data/lib/clucumber/vendor/cl-unicode/util.lisp +274 -0
  63. data/lib/clucumber/vendor/lift/compare/fiveam-tests.lisp +14 -0
  64. data/lib/clucumber/vendor/lift/compare/lift-tests.lisp +13 -0
  65. data/lib/clucumber/vendor/lift/compare/rt-tests.lisp +16 -0
  66. data/lib/clucumber/vendor/lift/compare/xlunit-tests.lisp +15 -0
  67. data/lib/clucumber/vendor/lift/dev/changes.lisp +61 -0
  68. data/lib/clucumber/vendor/lift/dev/config.lisp +354 -0
  69. data/lib/clucumber/vendor/lift/dev/copy-file.lisp +117 -0
  70. data/lib/clucumber/vendor/lift/dev/introspection.lisp +232 -0
  71. data/lib/clucumber/vendor/lift/dev/lift-interface.lisp +56 -0
  72. data/lib/clucumber/vendor/lift/dev/lift-notes.lisp +202 -0
  73. data/lib/clucumber/vendor/lift/dev/lift-randomized.lisp +45 -0
  74. data/lib/clucumber/vendor/lift/dev/lift.lisp +2383 -0
  75. data/lib/clucumber/vendor/lift/dev/macros.lisp +229 -0
  76. data/lib/clucumber/vendor/lift/dev/measuring.lisp +156 -0
  77. data/lib/clucumber/vendor/lift/dev/packages.lisp +161 -0
  78. data/lib/clucumber/vendor/lift/dev/port.lisp +151 -0
  79. data/lib/clucumber/vendor/lift/dev/prototypes.lisp +282 -0
  80. data/lib/clucumber/vendor/lift/dev/random-testing.lisp +124 -0
  81. data/lib/clucumber/vendor/lift/dev/report-locations.lisp +13 -0
  82. data/lib/clucumber/vendor/lift/dev/reports.lisp +916 -0
  83. data/lib/clucumber/vendor/lift/dev/utilities.lisp +242 -0
  84. data/lib/clucumber/vendor/lift/docs/package.lisp +6 -0
  85. data/lib/clucumber/vendor/lift/docs/setup.lisp +17 -0
  86. data/lib/clucumber/vendor/lift/examples/basic-examples.lisp +289 -0
  87. data/lib/clucumber/vendor/lift/examples/random-testing.lisp +32 -0
  88. data/lib/clucumber/vendor/lift/lift-documentation.asd +28 -0
  89. data/lib/clucumber/vendor/lift/lift-test.asd +35 -0
  90. data/lib/clucumber/vendor/lift/lift.asd +77 -0
  91. data/lib/clucumber/vendor/lift/test/equality-tests.lisp +40 -0
  92. data/lib/clucumber/vendor/lift/test/finding-tests.lisp +32 -0
  93. data/lib/clucumber/vendor/lift/test/lift-test.lisp +783 -0
  94. data/lib/clucumber/vendor/lift/test/order-of-operations.lisp +54 -0
  95. data/lib/clucumber/vendor/lift/test/packages.lisp +17 -0
  96. data/lib/clucumber/vendor/lift/test/test-config-files.lisp +20 -0
  97. data/lib/clucumber/vendor/lift/test/test-dynamic-variables.lisp +57 -0
  98. data/lib/clucumber/vendor/lift/test/test-maximum-problems.lisp +74 -0
  99. data/lib/clucumber/vendor/lift/test/test-prototypes.lisp +278 -0
  100. data/lib/clucumber/vendor/lift/test/test-timeout.lisp +37 -0
  101. data/lib/clucumber/vendor/lift/test/tests-in-progress.lisp +62 -0
  102. data/lib/clucumber/vendor/lift/test/testsuite-expects.lisp +60 -0
  103. data/lib/clucumber/vendor/lift/timeout/package.lisp +13 -0
  104. data/lib/clucumber/vendor/lift/timeout/with-timeout.lisp +123 -0
  105. data/lib/clucumber/vendor/lift/website/stuff/Temp.lisp +34 -0
  106. data/lib/clucumber/vendor/st-json/st-json.asd +3 -0
  107. data/lib/clucumber/vendor/st-json/st-json.lisp +310 -0
  108. data/lib/clucumber/vendor/trivial-backtrace/dev/backtrace.lisp +127 -0
  109. data/lib/clucumber/vendor/trivial-backtrace/dev/fallback.lisp +10 -0
  110. data/lib/clucumber/vendor/trivial-backtrace/dev/map-backtrace.lisp +103 -0
  111. data/lib/clucumber/vendor/trivial-backtrace/dev/mucking.lisp +75 -0
  112. data/lib/clucumber/vendor/trivial-backtrace/dev/packages.lisp +13 -0
  113. data/lib/clucumber/vendor/trivial-backtrace/dev/utilities.lisp +104 -0
  114. data/lib/clucumber/vendor/trivial-backtrace/test/packages.lisp +5 -0
  115. data/lib/clucumber/vendor/trivial-backtrace/test/test-setup.lisp +4 -0
  116. data/lib/clucumber/vendor/trivial-backtrace/test/tests.lisp +16 -0
  117. data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace-test.asd +22 -0
  118. data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace.asd +35 -0
  119. data/lib/clucumber/vendor/usocket/backend/allegro.lisp +199 -0
  120. data/lib/clucumber/vendor/usocket/backend/armedbear.lisp +491 -0
  121. data/lib/clucumber/vendor/usocket/backend/clisp.lisp +260 -0
  122. data/lib/clucumber/vendor/usocket/backend/cmucl.lisp +266 -0
  123. data/lib/clucumber/vendor/usocket/backend/lispworks.lisp +741 -0
  124. data/lib/clucumber/vendor/usocket/backend/mcl.lisp +369 -0
  125. data/lib/clucumber/vendor/usocket/backend/openmcl.lisp +206 -0
  126. data/lib/clucumber/vendor/usocket/backend/sbcl.lisp +424 -0
  127. data/lib/clucumber/vendor/usocket/backend/scl.lisp +261 -0
  128. data/lib/clucumber/vendor/usocket/condition.lisp +227 -0
  129. data/lib/clucumber/vendor/usocket/package.lisp +82 -0
  130. data/lib/clucumber/vendor/usocket/server.lisp +45 -0
  131. data/lib/clucumber/vendor/usocket/test/package.lisp +13 -0
  132. data/lib/clucumber/vendor/usocket/test/test-usocket.lisp +166 -0
  133. data/lib/clucumber/vendor/usocket/usocket-test.asd +26 -0
  134. data/lib/clucumber/vendor/usocket/usocket.asd +37 -0
  135. data/lib/clucumber/vendor/usocket/usocket.lisp +542 -0
  136. data/lib/clucumber/vendor/usocket/vendor/kqueue.lisp +1 -0
  137. data/lib/clucumber/vendor/usocket/vendor/split-sequence.lisp +245 -0
  138. data/lib/clucumber.rb +29 -7
  139. metadata +151 -5
@@ -0,0 +1,783 @@
1
+ ;;;-*- Mode: Lisp; Package: LIFT -*-
2
+
3
+ #|
4
+
5
+ See file COPYING for license
6
+
7
+ |#
8
+
9
+ (in-package #:lift-test)
10
+
11
+ (deftestsuite lift-test () ())
12
+
13
+ ;;; ---------------------------------------------------------------------------
14
+ ;;; lift-test-ensure
15
+ ;;; make sure that ensure and its friends work as expected
16
+ ;;;
17
+ ;;; The strategy here is to pair "regular" tests with meta-tests. The
18
+ ;;; regular tests are normal tests written using LIFT. The meta-tests
19
+ ;;; use run-tests or run-tests to run the regular test and then grovel
20
+ ;;; over the returned test-result to make sure it contains what it is
21
+ ;;; supposed to.
22
+ ;;;
23
+ ;;; Note that if we don't pass in :report-pathname nil, then we'll get a lot
24
+ ;;; of spurious extra report files...
25
+ ;;; ---------------------------------------------------------------------------
26
+
27
+ (deftestsuite lift-test-ensure (lift-test) ())
28
+
29
+ (deftestsuite lift-test-ensure-helper () ())
30
+
31
+ (addtest (lift-test-ensure-helper)
32
+ simple-ensure-test-1
33
+ (ensure t))
34
+
35
+ (addtest (lift-test-ensure)
36
+ simple-ensure-test-1
37
+ (let ((tr (run-test :suite 'lift-test-ensure-helper
38
+ :name 'simple-ensure-test-1)))
39
+ (ensure-same (length (tests-run tr)) 1)
40
+ (ensure-null (failures tr))
41
+ (ensure-null (errors tr))
42
+ (ensure-same (test-mode tr) :single)
43
+ (ensure-same (mapcar #'second (tests-run tr))
44
+ '(lift-test::simple-ensure-test-1))))
45
+
46
+ ;;; ---------------------------------------------------------------------------
47
+
48
+ (addtest (lift-test-ensure-helper)
49
+ simple-ensure-test-2
50
+ (ensure nil))
51
+
52
+ (addtest (lift-test-ensure)
53
+ simple-ensure-test-2
54
+ (let ((tr (run-test :suite 'lift-test-ensure-helper
55
+ :name 'simple-ensure-test-2)))
56
+ (ensure-same (length (tests-run tr)) 1 :report "Number of tests-run")
57
+ (ensure-same (length (failures tr)) 1 :report "Number of failures")
58
+ (ensure-null (errors tr) :report "Number of errors")
59
+ (ensure-same (mapcar #'second (tests-run tr))
60
+ '(lift-test::simple-ensure-test-2))))
61
+
62
+ ;;; ---------------------------------------------------------------------------
63
+
64
+ (addtest (lift-test-ensure-helper)
65
+ simple-ensure-test-3
66
+ (handler-case
67
+ (ensure (let ((x 0)) (/ x)))
68
+ (error (c)
69
+ (print c)
70
+ (error c))))
71
+
72
+ (addtest (lift-test-ensure)
73
+ simple-ensure-test-3
74
+ (let ((tr (run-test :suite 'lift-test-ensure-helper
75
+ :name 'simple-ensure-test-3)))
76
+ (ensure-same (length (tests-run tr)) 1)
77
+ (ensure-same (length (failures tr)) 0)
78
+ (ensure-same (length (errors tr)) 1)
79
+ (ensure-same (mapcar #'second (tests-run tr))
80
+ '(lift-test::simple-ensure-test-3))))
81
+
82
+
83
+ ;;; ---------------------------------------------------------------------------
84
+ ;;; lift-test-setup-teardown
85
+ ;;; make sure that setup and teardown happen in the right order
86
+ ;;; ---------------------------------------------------------------------------
87
+
88
+ (deftestsuite lift-test-setup-teardown (lift-test) ())
89
+
90
+ (deftestsuite lift-test-setup-teardown-1 (lift-test-setup-teardown) ()
91
+ (:setup (push 1 *test-notepad*))
92
+ (:teardown (push :a *test-notepad*))
93
+ (:tests (setup-teardown-1 (push 'test-1 *test-notepad*))))
94
+
95
+ (addtest (lift-test-setup-teardown)
96
+ setup-teardown-1
97
+ (setf *test-notepad* nil)
98
+ (run-test
99
+ :name 'setup-teardown-1
100
+ :suite 'lift-test-setup-teardown-1
101
+ :result (make-test-result 'lift-test-setup-teardown-1 :single))
102
+ (ensure-same (reverse *test-notepad*)
103
+ '(1 test-1 :a)))
104
+
105
+ (addtest (lift-test-setup-teardown)
106
+ setup-teardown-1-all
107
+ (setf *test-notepad* nil)
108
+ (run-tests
109
+ :suite 'lift-test-setup-teardown-1
110
+ :result (make-test-result 'lift-test-setup-teardown-1 :multiple)
111
+ :report-pathname nil)
112
+ (ensure-same (reverse *test-notepad*)
113
+ '(1 test-1 :a 1 2 test-2 :b :a 1 2 3 test-3 :c :b :a)))
114
+
115
+ (deftestsuite lift-test-setup-teardown-2 (lift-test-setup-teardown-1) ()
116
+ (:setup (push 2 *test-notepad*))
117
+ (:teardown (push :b *test-notepad*))
118
+ (:tests (setup-teardown-2 (push 'test-2 *test-notepad*))))
119
+
120
+ (deftestsuite lift-test-setup-teardown-3 (lift-test-setup-teardown-2) ()
121
+ (:setup (push 3 *test-notepad*))
122
+ (:teardown (push :c *test-notepad*))
123
+ (:tests (setup-teardown-3 (push 'test-3 *test-notepad*))))
124
+
125
+ (addtest (lift-test-setup-teardown)
126
+ setup-teardown-3
127
+ (setf *test-notepad* nil)
128
+ (run-test
129
+ :name 'setup-teardown-3
130
+ :suite 'lift-test-setup-teardown-3
131
+ :result (make-test-result 'lift-test-setup-teardown-3 :single))
132
+ (ensure-same (reverse *test-notepad*)
133
+ '(1 2 3 test-3 :c :b :a)))
134
+
135
+ (addtest (lift-test-setup-teardown)
136
+ setup-teardown-3-all
137
+ (setf *test-notepad* nil)
138
+ (run-tests
139
+ :suite 'lift-test-setup-teardown-3
140
+ :result (make-test-result 'lift-test-setup-teardown-3 :multiple)
141
+ :report-pathname nil)
142
+ (ensure-same (reverse *test-notepad*)
143
+ '(1 2 3 test-3 :c :b :a)))
144
+
145
+ ;;; ---------------------------------------------------------------------------
146
+ ;;; test ensure same
147
+ ;;; ---------------------------------------------------------------------------
148
+
149
+ (deftestsuite lift-test-ensure-comparisons (lift-test)
150
+ ())
151
+
152
+ ;;?? Gary King 2004-06-21: not really a test yet, more of a syntax works check
153
+ (addtest (lift-test-ensure-comparisons)
154
+ same-basic
155
+ (ensure-same 2 2)
156
+ (ensure-same 2 2 :test =)
157
+ (ensure-same 2 2 :test '=)
158
+ (ensure-same 2 2 :test #'=))
159
+
160
+ (addtest (lift-test-ensure-comparisons)
161
+ same-test-flet
162
+ (flet ((check (a b)
163
+ (= (abs a) (abs b))))
164
+ (ensure-same 2 -2 :test #'check)
165
+ (ensure-same 2 -2 :test 'check)
166
+ (ensure-same 2 -2 :test check)))
167
+
168
+ (addtest (lift-test-ensure-comparisons)
169
+ same-test-labels
170
+ (labels ((check (a b)
171
+ (= (abs a) (abs b))))
172
+ (ensure-same 2 -2 :test #'check)
173
+ (ensure-same 2 -2 :test 'check)
174
+ (ensure-same 2 -2 :test check)))
175
+
176
+ (defun %make-test-ensure-same-test (fn)
177
+ (lambda (a b)
178
+ (funcall fn a b)))
179
+
180
+ (addtest (lift-test-ensure-comparisons)
181
+ same-test-with-test-maker
182
+ (ensure-same 2 2 :test (%make-test-ensure-same-test #'=)))
183
+
184
+ ;;?? Gary King 2004-06-21: not really a test yet, more of a syntax works check
185
+ (addtest (lift-test-ensure-comparisons)
186
+ different-basic
187
+ (ensure-different 2 -12)
188
+ (ensure-different -2 2 :test =)
189
+ (ensure-different 20 2 :test '=)
190
+ (ensure-different 2 2.1 :test #'=))
191
+
192
+ (addtest (lift-test-ensure-comparisons)
193
+ different-test-flet
194
+ (flet ((check (a b)
195
+ (= (abs a) (abs b))))
196
+ (ensure-different 2 -2.1 :test #'check)
197
+ (ensure-different 1.9 -2 :test 'check)
198
+ (ensure-different 20 -2 :test check)))
199
+
200
+ (addtest (lift-test-ensure-comparisons)
201
+ different-test-labels
202
+ (labels ((check (a b)
203
+ (= (abs a) (abs b))))
204
+ (ensure-different 2 -2.1 :test #'check)
205
+ (ensure-different 1.9 -2 :test 'check)
206
+ (ensure-different 20 -2 :test check)))
207
+
208
+ (addtest (lift-test-ensure-comparisons)
209
+ different-test-with-test-maker
210
+ (ensure-different 20 2 :test (%make-test-ensure-same-test #'=)))
211
+
212
+
213
+
214
+ ;;; ---------------------------------------------------------------------------
215
+ ;;; test single setup
216
+ ;;; ---------------------------------------------------------------------------
217
+
218
+ (deftestsuite test-single-setup (lift-test) ())
219
+
220
+ ;; helpers
221
+ (deftestsuite test-single-setup-helper () ())
222
+
223
+ (deftestsuite test-single-setup-child-a (test-single-setup-helper) ()
224
+ (:setup (push :a *test-notepad*))
225
+ (:test (test-1 (ensure t))))
226
+
227
+ (deftestsuite test-single-setup-child-a-1 (test-single-setup-child-a) ()
228
+ (:setup (push :a-1 *test-notepad*))
229
+ (:test (test-1 (ensure t)))
230
+ (:test (test-2 (ensure t))))
231
+
232
+ (deftestsuite test-single-setup-child-b (test-single-setup-helper) ()
233
+ (:setup (push :b *test-notepad*))
234
+ (:test (test-1 (ensure t))))
235
+
236
+ (deftestsuite test-single-setup-child-b-1-ss (test-single-setup-child-b) ()
237
+ (:run-setup :once-per-suite)
238
+ (:setup (push :b-1 *test-notepad*))
239
+ (:test (test-1 (ensure t)))
240
+ (:test (test-2 (ensure t))))
241
+
242
+ (deftestsuite test-single-setup-child-b-1-a (test-single-setup-child-b-1-ss) ()
243
+ (:setup (push :b-1-a *test-notepad*))
244
+ (:test (test-1 (ensure t)))
245
+ (:test (test-2 (ensure t))))
246
+
247
+ (deftestsuite test-single-setup-child-b-1-b (test-single-setup-child-b-1-ss) ()
248
+ (:setup (push :b-1-b *test-notepad*))
249
+ (:test (test-1 (ensure t)))
250
+ (:test (test-2 (ensure t))))
251
+
252
+ (deftestsuite test-single-setup-child-c (test-single-setup-helper) ()
253
+ (:setup (push :c *test-notepad*))
254
+ (:test (test-1 (ensure t))))
255
+
256
+ (deftestsuite test-single-setup-child-c-1 (test-single-setup-child-c) ()
257
+ (:setup (push :c-1 *test-notepad*))
258
+ (:test (test-1 (ensure t))))
259
+
260
+ ;;; ---------------------------------------------------------------------------
261
+
262
+ (addtest (test-single-setup)
263
+ test-a-multiple-setup
264
+ (setf *test-notepad* nil)
265
+ (run-test :suite 'test-single-setup-child-a-1 :name 'test-1)
266
+ (run-test :suite 'test-single-setup-child-a-1 :name 'test-2)
267
+ (ensure-same *test-notepad* '(:a-1 :a :a-1 :a)))
268
+
269
+ (addtest (test-single-setup)
270
+ test-b-single-setup-1
271
+ (setf *test-notepad* nil)
272
+ (run-test :suite 'test-single-setup-child-b-1-ss :name 'test-1)
273
+ (run-test :suite 'test-single-setup-child-b-1-ss :name 'test-2)
274
+ ;; single tests do all the setup so this should be exactly the same
275
+ (ensure-same *test-notepad* '(:b-1 :b :b-1 :b)))
276
+
277
+ (addtest (test-single-setup)
278
+ test-a-single-setup-2
279
+ (setf *test-notepad* nil)
280
+ (run-tests :suite 'test-single-setup-child-a-1 :do-children? nil
281
+ :report-pathname nil)
282
+ (ensure-same *test-notepad* '(:a-1 :a :a-1 :a)))
283
+
284
+ (addtest (test-single-setup)
285
+ test-a-single-setup-3
286
+ (setf *test-notepad* nil)
287
+ (run-tests :suite 'test-single-setup-child-a-1
288
+ :run-setup :once-per-suite
289
+ :do-children? nil
290
+ :report-pathname nil)
291
+ (ensure-same *test-notepad* '(:a-1 :a :a-1 :a)))
292
+
293
+ (addtest (test-single-setup)
294
+ test-b-single-setup-2
295
+ (setf *test-notepad* nil)
296
+ (run-tests :suite 'test-single-setup-child-b-1-ss :do-children? nil
297
+ :report-pathname nil)
298
+ (ensure-same *test-notepad* '(:b-1 :b)))
299
+
300
+ ;;; ---------------------------------------------------------------------------
301
+ ;;; warning behavior
302
+ ;;; ---------------------------------------------------------------------------
303
+
304
+ (deftestsuite test-ignore-warnings (lift-test) ())
305
+
306
+ (deftestsuite test-ignore-warnings-helper () ())
307
+
308
+ (deftestsuite test-ignore-warnings-helper-warning (test-ignore-warnings-helper) ()
309
+ (:test (do-it
310
+ (push :a *test-scratchpad*)
311
+ (warn "Ouch")
312
+ (push :b *test-scratchpad*))))
313
+
314
+ (deftestsuite test-ignore-warnings-helper-no-warning (test-ignore-warnings-helper) ()
315
+ (:test (do-it
316
+ (push :a *test-scratchpad*)
317
+ (+ 2 2)
318
+ (push :b *test-scratchpad*))))
319
+
320
+ (addtest (test-ignore-warnings)
321
+ test-has-warning
322
+ (run-test :suite 'test-ignore-warnings-helper-warning :name 'do-it)
323
+ (ensure-same *test-scratchpad* '(:b :a)))
324
+
325
+ (addtest (test-ignore-warnings)
326
+ test-has-no-warning
327
+ (run-test :suite 'test-ignore-warnings-helper-no-warning :name 'do-it)
328
+ (ensure-same *test-scratchpad* '(:b :a)))
329
+
330
+ ;;; ---------------------------------------------------------------------------
331
+ ;;; test-environment stays clean
332
+ ;;; ---------------------------------------------------------------------------
333
+
334
+ (deftestsuite lift-test-environment-pristine (lift-test) ()
335
+ (:setup (setf *test-environment* nil)))
336
+
337
+ (deftestsuite lift-test-environment-pristine-helper ()
338
+ ((a 2)
339
+ (b (* a a))))
340
+
341
+ (addtest (lift-test-environment-pristine-helper)
342
+ do-it
343
+ (ensure-same (* a a) b))
344
+
345
+ (addtest (lift-test-environment-pristine
346
+ :expected-failure "This is no longer guarenteed; I'm not sure yet whether or not this is a good thing.")
347
+ test-1
348
+ (run-test :suite 'lift-test-environment-pristine-helper :name 'do-it)
349
+ (ensure (null *test-environment*)))
350
+
351
+
352
+ ;;; ---------------------------------------------------------------------------
353
+ ;;; test-creating-multiple-tests
354
+ ;;; ---------------------------------------------------------------------------
355
+
356
+ (deftestsuite test-creating-multiple-tests (lift-test)
357
+ ())
358
+
359
+ (deftestsuite test-creating-multiple-tests-helper ()
360
+ ()
361
+ (:tests ((ensure-same 1 1)
362
+ (ensure-same 2 2))
363
+ ((ensure-same 3 3))))
364
+
365
+ (addtest (test-creating-multiple-tests)
366
+ test-1
367
+ (ensure-same (testsuite-test-count 'test-creating-multiple-tests-helper) 2))
368
+
369
+ ;;;;;
370
+
371
+ (defvar *dynamics-before-setup* :dbs)
372
+
373
+ (deftestsuite dynamics-before-setup (lift-test)
374
+ ()
375
+ :setup (setf *test-notepad* nil))
376
+
377
+ (deftestsuite dynamics-before-setup-helper ()
378
+ ((slot (progn (push :slot *test-notepad*) :slot)))
379
+ :dynamic-variables (*dynamics-before-setup*
380
+ (progn (push :dynamics *test-notepad*) :dynamics))
381
+ (:setup (push :setup *test-notepad*) (print (list :tn *test-notepad*))))
382
+
383
+ (addtest (dynamics-before-setup-helper)
384
+ test-1
385
+ (push :test *test-notepad*)
386
+ (ensure-same *dynamics-before-setup* :dynamics))
387
+
388
+ (addtest (dynamics-before-setup)
389
+ test-1
390
+ (run-test :suite 'dynamics-before-setup-helper
391
+ :name 'test-1)
392
+ (ensure-same (reverse *test-notepad*)
393
+ '(:dynamics :slot :setup :test)))
394
+
395
+
396
+ ;;;;;
397
+ ;;; inherited functions
398
+
399
+ (deftestsuite test-inherited-functions-helper ()
400
+ ()
401
+ (:function
402
+ (really? (a b c)
403
+ (ensure-same (+ a b) c :test '=))))
404
+
405
+ (deftestsuite test-inherited-functions-pos (test-inherited-functions-helper)
406
+ ()
407
+ (:tests ((really? 1 2 3))
408
+ ((really? 4 5 9))))
409
+
410
+ (deftestsuite test-inherited-functions-neg (test-inherited-functions-helper)
411
+ ()
412
+ (:tests ((really? -4 -2 -6))
413
+ ((really? -1 -1 -2))))
414
+
415
+ (deftestsuite test-inherited-functions (lift-test)
416
+ ())
417
+
418
+ (addtest (test-inherited-functions)
419
+ one
420
+ (let ((tr (run-tests :suite 'test-inherited-functions-helper
421
+ :report-pathname nil)))
422
+ (ensure-same (length (tests-run tr)) 4)
423
+ (ensure-null (failures tr))
424
+ (ensure-null (errors tr))))
425
+
426
+
427
+ ;;;;;
428
+ ;;; slot initialization takes place with every setup
429
+
430
+ (deftestsuite test-initialize-slots-helper ()
431
+ ((slot (incf *test-notepad*))))
432
+
433
+ (addtest (test-initialize-slots-helper)
434
+ one
435
+ (ensure t))
436
+
437
+ (addtest (test-initialize-slots-helper)
438
+ two
439
+ (ensure-null nil))
440
+
441
+ (deftestsuite test-initialize-slots (lift-test)
442
+ ()
443
+ (:setup (setf *test-notepad* 0)))
444
+
445
+ (addtest (test-initialize-slots)
446
+ slot-initform-evaluated-every-time
447
+ (let ((tr (run-tests :suite 'test-initialize-slots-helper
448
+ :report-pathname nil)))
449
+ (ensure-same (length (tests-run tr)) 2)
450
+ (ensure-same *test-notepad* 2 :test '=)))
451
+
452
+ ;;;;;
453
+ ;;; errors during tests are reported in the test result
454
+
455
+ (defun cause-an-error ()
456
+ (error "this is an error"))
457
+
458
+ (deftestsuite test-error-catching (lift-test)
459
+ ())
460
+
461
+ (deftestsuite test-error-catching-helper-slot-init ()
462
+ ((x (cause-an-error))))
463
+
464
+ (addtest (test-error-catching-helper-slot-init)
465
+ slot-init
466
+ (ensure t))
467
+
468
+ (addtest (test-error-catching)
469
+ helper-slot-init
470
+ (let ((result (run-test :suite 'test-error-catching-helper-slot-init
471
+ :name 'slot-init)))
472
+ (ensure-same 1 (length (lift::suites-run result)) :report "tests run")
473
+ (ensure-same 1 (length (errors result)) :report "errors counted")))
474
+
475
+ ;;;
476
+
477
+ (deftestsuite test-error-catching-helper-body ()
478
+ ())
479
+
480
+ (addtest (test-error-catching-helper-body)
481
+ body
482
+ (cause-an-error))
483
+
484
+ (addtest (test-error-catching)
485
+ helper-body
486
+ (let ((result (run-test :suite 'test-error-catching-helper-body
487
+ :name 'body)))
488
+ (ensure-same 1 (length (tests-run result)))
489
+ (ensure-same 1 (length (errors result)))))
490
+
491
+ ;;;
492
+
493
+ (deftestsuite test-error-catching-helper-setup ()
494
+ ()
495
+ (:setup
496
+ (cause-an-error)))
497
+
498
+ (addtest (test-error-catching-helper-setup)
499
+ setup
500
+ (ensure t))
501
+
502
+ (addtest (test-error-catching)
503
+ helper-setup
504
+ (let ((result (run-test :suite 'test-error-catching-helper-setup
505
+ :name 'setup)))
506
+ (ensure-same 1 (length (tests-run result)))
507
+ (ensure-same 1 (length (errors result)))))
508
+
509
+ ;;;
510
+
511
+ (deftestsuite test-error-catching-helper-teardown ()
512
+ ()
513
+ (:teardown
514
+ (cause-an-error)))
515
+
516
+ (addtest (test-error-catching-helper-teardown)
517
+ teardown
518
+ (ensure t))
519
+
520
+ (addtest (test-error-catching)
521
+ helper-teardown
522
+ (let ((result (run-test :suite 'test-error-catching-helper-teardown
523
+ :name 'teardown)))
524
+ (ensure-same 1 (length (tests-run result)))
525
+ (ensure-same 1 (length (errors result)))))
526
+
527
+ ;;;
528
+
529
+ (defvar *test-error-catching-helper*)
530
+
531
+ (deftestsuite test-error-catching-helper-dynamic-variables ()
532
+ ()
533
+ (:dynamic-variables
534
+ (*test-error-catching-helper* (cause-an-error))))
535
+
536
+ (addtest (test-error-catching-helper-dynamic-variables)
537
+ dynamic-variables
538
+ (ensure t))
539
+
540
+ (addtest (test-error-catching)
541
+ helper-dynamic-variables
542
+ (let ((result (run-test :suite 'test-error-catching-helper-dynamic-variables
543
+ :name 'dynamic-variables)))
544
+ (ensure-same 1 (length (lift::suites-run result)))
545
+ (ensure-same 1 (length (errors result)))))
546
+
547
+ ;;;
548
+
549
+ (deftestsuite test-error-catching-helper-equality-test ()
550
+ ()
551
+ (:equality-test
552
+ (cause-an-error)))
553
+
554
+ (addtest (test-error-catching-helper-equality-test)
555
+ equality-test
556
+ (ensure t))
557
+
558
+ (addtest (test-error-catching)
559
+ helper-equality-test
560
+ (let ((result (run-test :suite 'test-error-catching-helper-equality-test
561
+ :name 'equality-test)))
562
+ (ensure-same 0 (length (lift::suites-run result))) ;hmmm
563
+ (ensure-same 1 (length (errors result)))))
564
+
565
+ ;;;;
566
+
567
+ (deftestsuite test-interaction (lift-test)
568
+ ()
569
+ (:equality-test #'string=))
570
+
571
+ (addtest (test-interaction)
572
+ run-test-sets-values
573
+ (run-test :suite 'lift-test-ensure-helper :name 'simple-ensure-test-3)
574
+ (ensure-same
575
+ (symbol-name lift::*current-test-case-name*)
576
+ (symbol-name 'simple-ensure-test-3))
577
+ (ensure-same
578
+ (symbol-name lift::*current-testsuite-name*)
579
+ (symbol-name 'lift-test-ensure-helper)))
580
+
581
+ (addtest (test-interaction)
582
+ run-tests-sets-values
583
+ (run-tests :suite 'lift-test-ensure-helper
584
+ :report-pathname nil)
585
+ (ensure-same
586
+ (symbol-name lift::*current-testsuite-name*)
587
+ (symbol-name 'lift-test-ensure-helper))
588
+ (ensure-same
589
+ (symbol-name lift::*current-test-case-name*)
590
+ (symbol-name 'simple-ensure-test-3)))
591
+
592
+ (addtest (test-interaction)
593
+ run-test-sets-values-nested
594
+ (run-test :suite 'test-interaction :test-case 'run-tests-sets-values)
595
+ (ensure-same
596
+ (symbol-name lift::*current-testsuite-name*)
597
+ (symbol-name 'test-interaction))
598
+ (ensure-same
599
+ (symbol-name lift::*current-test-case-name*)
600
+ (symbol-name 'run-tests-sets-values)))
601
+
602
+ ;;;;
603
+
604
+ (deftestsuite test-expected-errors (lift-test)
605
+ ())
606
+
607
+ (deftestsuite test-expected-errors-helper ()
608
+ ())
609
+
610
+ (addtest (test-expected-errors-helper
611
+ :expected-error t)
612
+ test-1
613
+ (error "this is an error"))
614
+
615
+ (addtest (test-expected-errors)
616
+ test-passes
617
+ (let ((result (run-tests :suite 'test-expected-errors-helper
618
+ :report-pathname nil)))
619
+ (ensure-same 1 (length (tests-run result)))
620
+ (ensure-same 0 (length (errors result)))
621
+ (ensure-same 1 (length (expected-errors result)))
622
+ ))
623
+
624
+ (eval-when (:compile-toplevel :load-toplevel :execute)
625
+ (defparameter *test-expected-errors-helper-2* nil))
626
+
627
+ (deftestsuite test-expected-errors-helper-2 ()
628
+ ())
629
+
630
+ (addtest (test-expected-errors-helper-2
631
+ :expected-error *test-expected-errors-helper-2*)
632
+ test-1
633
+ (error "this is an error"))
634
+
635
+ (addtest (test-expected-errors)
636
+ test-expected-error-helper-true
637
+ (let* ((*test-expected-errors-helper-2* t)
638
+ (result (run-tests :suite 'test-expected-errors-helper-2
639
+ :report-pathname nil)))
640
+ (ensure-same 1 (length (tests-run result)))
641
+ (ensure-same 0 (length (errors result)))
642
+ (ensure-same 1 (length (expected-errors result)))
643
+ ))
644
+
645
+ (addtest (test-expected-errors)
646
+ test-expected-error-helper-false
647
+ (let* ((*test-expected-errors-helper-2* nil)
648
+ (result (run-tests :suite 'test-expected-errors-helper-2
649
+ :report-pathname nil)))
650
+ (ensure-same 1 (length (tests-run result)))
651
+ (ensure-same 1 (length (errors result)))
652
+ (ensure-same 0 (length (expected-errors result)))
653
+ ))
654
+
655
+ (addtest (test-expected-errors)
656
+ donot-break-on-errors
657
+ ;; this is weird
658
+ ;; I wonder if it's worth trying to abstract "up"
659
+ (let ((*debugger-hook* (lambda (condition hook)
660
+ (declare (ignore hook))
661
+ (when (find-restart 'entered-debugger)
662
+ (invoke-restart 'entered-debugger condition))
663
+ (invoke-debugger condition))))
664
+ (restart-case
665
+ (let ((result (run-tests :suite 'test-expected-errors-helper
666
+ :report-pathname nil
667
+ :break-on-errors? t)))
668
+ (ensure-same 1 (length (tests-run result)))
669
+ (ensure-same 0 (length (errors result)))
670
+ (ensure-same 1 (length (expected-errors result)))
671
+ )
672
+ (entered-debugger (c)
673
+ (declare (ignore c))
674
+ (ensure-null "We should not be here")))))
675
+
676
+ ;;;;
677
+
678
+ ;;?? these pass but the cliquep test did not seem to be working. Why?
679
+ (deftestsuite test-scratchpad-resets (lift-test)
680
+ ())
681
+
682
+ (deftestsuite test-scratchpad-resets-helper ()
683
+ ()
684
+ (:test
685
+ (test-3 (push :test *test-scratchpad*)))
686
+ (:test
687
+ (test-4 (push :burt *test-scratchpad*))))
688
+
689
+ (addtest (test-scratchpad-resets)
690
+ run-once-have-one
691
+ (run-test :suite 'test-scratchpad-resets-helper :test-case 'test-3)
692
+ (ensure-same '(:test) *test-scratchpad*))
693
+
694
+ (addtest (test-scratchpad-resets)
695
+ run-twice-have-one
696
+ (run-test :suite 'test-scratchpad-resets-helper :test-case 'test-3)
697
+ (run-test :suite 'test-scratchpad-resets-helper :test-case 'test-3)
698
+ (ensure-same '(:test) *test-scratchpad*))
699
+
700
+ (addtest (test-scratchpad-resets)
701
+ run-twice-have-one-run-tests
702
+ (run-tests :suite 'test-scratchpad-resets-helper :report-pathname nil)
703
+ (run-tests :suite 'test-scratchpad-resets-helper :report-pathname nil)
704
+ (ensure-same '(:burt) *test-scratchpad*))
705
+
706
+ ;;;;
707
+
708
+ (deftestsuite test-break-on-failure (lift-test)
709
+ ())
710
+
711
+ (deftestsuite test-break-on-failure-helper ()
712
+ ()
713
+ ;; :categories (foo bar)
714
+ )
715
+
716
+ (addtest (test-break-on-failure-helper)
717
+ failing-test
718
+ (ensure-null "this fails"))
719
+
720
+ (addtest (test-break-on-failure)
721
+ donot-break-on-failures
722
+ (let* ((*test-break-on-failures?* nil)
723
+ (result (run-tests :suite 'test-break-on-failure-helper
724
+ :report-pathname nil)))
725
+ (ensure-same 1 (length (tests-run result)))
726
+ (ensure-same 1 (length (failures result)))))
727
+
728
+ (addtest (test-break-on-failure)
729
+ do-break-on-failures
730
+ (let* ((*test-break-on-failures?* t)
731
+ (*debugger-hook* (lambda (condition hook)
732
+ (declare (ignore hook))
733
+ (when (find-restart 'entered-debugger)
734
+ (invoke-restart 'entered-debugger condition))
735
+ (invoke-debugger condition)))
736
+ (result nil))
737
+ (restart-case
738
+ (setf result (run-tests :suite 'test-break-on-failure-helper
739
+ :report-pathname nil))
740
+ (entered-debugger (c)
741
+ (declare (ignore c))
742
+ (setf *test-scratchpad* t)))
743
+ (ensure-null result)
744
+ (ensure-same *test-scratchpad* t :test 'eq)))
745
+
746
+ ;;;;
747
+
748
+ (deftestsuite ensure-no-warning (lift-test)
749
+ ())
750
+
751
+ (deftestsuite ensure-no-warning-helper ()
752
+ ())
753
+
754
+ (addtest (ensure-no-warning-helper)
755
+ test-1
756
+ (ensure-no-warning (ensure-same (+ 2 2) 4)))
757
+
758
+ (addtest (ensure-no-warning-helper)
759
+ test-2
760
+ (ensure-no-warning (ensure-same (+ 2 2) 4)
761
+ (warn "I like math")))
762
+
763
+ (addtest (ensure-no-warning)
764
+ run-tests
765
+ (let ((result (run-tests :suite 'ensure-no-warning-helper
766
+ :report-pathname nil)))
767
+ (ensure-same (length (tests-run result)) 2)
768
+ (ensure-same (length (failures result)) 1)
769
+ (ensure-same (length (errors result)) 0)))
770
+
771
+ ;;;;;
772
+
773
+ (deftestsuite test-suite-with-no-tests-helper ()
774
+ ())
775
+
776
+ (deftestsuite test-test-suite-with-no-tests (lift-test)
777
+ ()
778
+ (:documentation "Case 168"))
779
+
780
+ (addtest (test-test-suite-with-no-tests)
781
+ test-1
782
+ (let ((r (run-tests :suite 'test-suite-with-no-tests-helper)))
783
+ (ensure-same (length (tests-run r)) 0)))