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,54 @@
1
+ (in-package #:lift-test)
2
+
3
+ ;; see lift-test-setup-teardown tests too
4
+ (deftestsuite order-of-operations (lift-test)
5
+ ()
6
+ (:setup
7
+ (setf *test-notepad* nil)))
8
+
9
+ (deftestsuite order-of-operations-helper ()
10
+ ((slot (push :slot-init-parent *test-notepad*)))
11
+ (:setup
12
+ (push :setup-parent *test-notepad*))
13
+ (:teardown
14
+ (push :teardown-parent *test-notepad*)))
15
+
16
+ (addtest (order-of-operations-helper)
17
+ test-1
18
+ (push :run-test-parent *test-notepad*))
19
+
20
+ (deftestsuite order-of-operations-helper-subclass (order-of-operations-helper)
21
+ ((slot (push :slot-init-child *test-notepad*)))
22
+ (:setup
23
+ (push :setup-child *test-notepad*))
24
+ (:teardown
25
+ (push :teardown-child *test-notepad*)))
26
+
27
+ (addtest (order-of-operations-helper-subclass)
28
+ test-1
29
+ (push :run-test-child *test-notepad*))
30
+
31
+ (addtest (order-of-operations)
32
+ run-parent-test
33
+ (run-test :suite 'order-of-operations-helper
34
+ :name 'test-1
35
+ :result (make-test-result 'order-of-operations-helper :single))
36
+ (ensure-same
37
+ (reverse *test-notepad*)
38
+ (list :slot-init-parent :setup-parent :run-test-parent :teardown-parent)))
39
+
40
+ (addtest (order-of-operations)
41
+ run-child-test
42
+ (run-test :suite 'order-of-operations-helper-subclass
43
+ :name 'test-1
44
+ :result (make-test-result
45
+ 'order-of-operations-helper-subclass :single))
46
+ (ensure-same
47
+ (reverse *test-notepad*)
48
+ (list :slot-init-parent
49
+ :setup-parent
50
+ :slot-init-child
51
+ :setup-child
52
+ :run-test-child
53
+ :teardown-child
54
+ :teardown-parent)))
@@ -0,0 +1,17 @@
1
+ (in-package #:common-lisp-user)
2
+
3
+ (defpackage #:lift-test
4
+ (:use #:common-lisp #:lift)
5
+ (:import-from #:lift
6
+ #:failures
7
+ #:errors
8
+ #:tests-run
9
+ #:test-mode
10
+ #:test-interactive?
11
+ #:make-test-result
12
+ #:testsuite-test-count
13
+ #:*test-environment*
14
+ #:*test-maximum-error-count*
15
+ #:*test-maximum-failure-count*
16
+ #:failures
17
+ #:errors))
@@ -0,0 +1,20 @@
1
+ (in-package #:lift-test)
2
+
3
+ (deftestsuite test-config-files (lift-test) ())
4
+
5
+ (addtest (test-config-files)
6
+ unknown-test-suite
7
+ (let ((r
8
+ (lift:run-tests
9
+ :config (asdf:system-relative-pathname
10
+ 'lift-test "test/bad-config-1.config"))))
11
+ (ensure-same (length (lift::suites-run r)) 2)))
12
+
13
+ (addtest (test-config-files)
14
+ unknown-config-option
15
+ (let ((r
16
+ (lift:run-tests
17
+ :config (asdf:system-relative-pathname
18
+ 'lift-test "test/bad-config-2.config"))))
19
+ (ensure-same (length (lift::suites-run r)) 2)))
20
+
@@ -0,0 +1,57 @@
1
+ (in-package #:lift-test)
2
+
3
+ (defvar *a* 1)
4
+
5
+ (deftestsuite test-dynamic-variables (lift-test)
6
+ ())
7
+
8
+ (deftestsuite test-dynamic-variables-1 (test-dynamic-variables)
9
+ ()
10
+ (:dynamic-variables (*a* 2))
11
+ (:test (test-1 (ensure-same *a* 2))))
12
+
13
+ (deftestsuite test-dynamic-variables-2 (test-dynamic-variables)
14
+ ()
15
+ (:test (test-1 (ensure-same *a* 1)))
16
+ (:test (test-2 (ensure *a*))))
17
+
18
+ ;;;; syntax
19
+
20
+ (deftestsuite test-dynamic-variables-syntax-1 (test-dynamic-variables)
21
+ ()
22
+ (:dynamic-variables (*a* 0) (*b* 1))
23
+ (:test (test-1 (ensure-same (list :dv *a* *b*) '(:dv 0 1))))
24
+ )
25
+
26
+ (deftestsuite test-dynamic-variables-syntax-2 (test-dynamic-variables)
27
+ ()
28
+ (:dynamic-variables *a* *b*)
29
+ (:test (test-1 (ensure-same (list :dv *a* *b*) '(:dv nil nil))))
30
+ )
31
+
32
+ ;;;;
33
+
34
+ (deftestsuite dynamic-variables-helper-1 ()
35
+ ()
36
+ (:documentation "It's important that the dynamic variable is not
37
+ marked as special in the global environment.")
38
+ (:dynamic-variables *unknown-dynamic-variable*))
39
+
40
+ (deftestsuite dynamic-variables-helper-2 (dynamic-variables-helper-1)
41
+ ((my-slot *unknown-dynamic-variable*)))
42
+
43
+ (addtest (dynamic-variables-helper-2)
44
+ try-it
45
+ (ensure (+ 1 2)))
46
+
47
+ (deftestsuite test-non-special-dynamic-variables (test-dynamic-variables)
48
+ ())
49
+
50
+ (addtest (test-non-special-dynamic-variables)
51
+ try-it
52
+ (let ((r (run-tests :suite 'dynamic-variables-helper-2)))
53
+ (ensure-same (length (tests-run r)) 1)
54
+ (ensure-null (lift::errors r))
55
+ (ensure-null (lift::failures r))))
56
+
57
+
@@ -0,0 +1,74 @@
1
+ (in-package #:lift-test)
2
+
3
+ (deftestsuite test-maximum-problems (lift-test)
4
+ ()
5
+ (:function
6
+ (do-it (name)
7
+ ;; ignore cancel-testing-from-configuration into cancel-testing
8
+ (restart-case
9
+ (run-tests :suite name :report-pathname nil)
10
+ (lift::cancel-testing-from-configuration ()
11
+ :test (lambda (c) (declare (ignore c)) t)
12
+ nil
13
+ #+(or)
14
+ (invoke-restart (find-restart 'lift::cancel-testing)))))))
15
+
16
+ (addtest (test-maximum-problems)
17
+ all-nil
18
+ (let* ((*test-maximum-error-count* nil)
19
+ (*test-maximum-failure-count* nil)
20
+ (r (do-it 'test-maximum-problems-helper)))
21
+ (ensure-same (length (tests-run r)) 12)
22
+ (ensure-same (length (errors r)) 6)
23
+ (ensure-same (length (failures r)) 6)))
24
+
25
+ (addtest (test-maximum-problems)
26
+ max-3-failures
27
+ (let* ((*test-maximum-error-count* nil)
28
+ (*test-maximum-failure-count* 3)
29
+ (r (do-it 'test-maximum-problems-helper)))
30
+ (cond ((= (length (tests-run r)) 3)
31
+ (ensure-same (length (failures r)) 3))
32
+ ((= (length (tests-run r)) 9)
33
+ (ensure-same (length (errors r)) 6)
34
+ (ensure-same (length (failures r)) 3))
35
+ (t
36
+ (ensure-null t :report "Wrong number of tests run: ~d."
37
+ :arguments ((length (tests-run r))))))))
38
+
39
+ (addtest (test-maximum-problems)
40
+ max-2-errors
41
+ (let* ((*test-maximum-error-count* 2)
42
+ (*test-maximum-failure-count* nil)
43
+ (r (do-it 'test-maximum-problems-helper)))
44
+ (cond ((= (length (tests-run r)) 2)
45
+ (ensure-same (length (errors r)) 2))
46
+ ((= (length (tests-run r)) 8)
47
+ (ensure-same (length (errors r)) 2)
48
+ (ensure-same (length (failures r)) 6))
49
+ (t
50
+ (ensure-null t :report "Wrong number of tests run: ~d."
51
+ :arguments ((length (tests-run r))))))))
52
+
53
+ (deftestsuite test-maximum-problems-helper ()
54
+ ())
55
+
56
+ (deftestsuite test-maximum-problems-helper-failures
57
+ (test-maximum-problems-helper)
58
+ ()
59
+ (:test (a (ensure-same 1 2)))
60
+ (:test (b (ensure-same 1 2)))
61
+ (:test (c (ensure-same 1 2)))
62
+ (:test (d (ensure-same 1 2)))
63
+ (:test (e (ensure-same 1 2)))
64
+ (:test (f (ensure-same 1 2))))
65
+
66
+ (deftestsuite test-maximum-problems-helper-errors
67
+ (test-maximum-problems-helper)
68
+ ()
69
+ (:test (a (error "no good")))
70
+ (:test (b (error "no good")))
71
+ (:test (c (error "no good")))
72
+ (:test (d (error "no good")))
73
+ (:test (e (error "no good")))
74
+ (:test (f (error "no good"))))
@@ -0,0 +1,278 @@
1
+ (in-package #:lift)
2
+
3
+ (deftestsuite test-case-generation () ())
4
+ (deftestsuite test-case-generation-simple (test-case-generation) ())
5
+
6
+ ;;; ---------------------------------------------------------------------------
7
+ ;;; test-process-cases-form
8
+ ;;; ---------------------------------------------------------------------------
9
+
10
+ (deftestsuite test-process-cases-form () ())
11
+ (deftestsuite test-vars-from-assignment (test-process-cases-form) ())
12
+
13
+ (addtest (test-vars-from-assignment)
14
+ test-1
15
+ (ensure-same (vars-from-assignment '((:B ((A . 1) (B . 3)) ((A . 2) (B . 4)))))
16
+ '(a b)))
17
+
18
+ (addtest (test-vars-from-assignment)
19
+ test-2
20
+ (ensure-same (vars-from-assignment (list '(c '(a b)) '(d (list 'x 'y))))
21
+ '(c d)))
22
+
23
+ (addtest (test-vars-from-assignment)
24
+ test-3
25
+ (ensure-same (vars-from-assignment '((:B ((A . 1) (B . 3)) ((A . 2) (B . 4)))
26
+ (:B ((C . A) (D . X)) ((C . B) (D . Y)))))
27
+ '((a b) (c d))))
28
+
29
+ ;;; ---------------------------------------------------------------------------
30
+
31
+ (deftestsuite test-values-from-assignment (test-process-cases-form) ())
32
+
33
+ (addtest (test-values-from-assignment)
34
+ test-1
35
+ (ensure-same (values-from-assignment '((:B ((A . 1) (B . 3)) ((A . 2) (B . 4)))))
36
+ '((1 2) (3 4))))
37
+
38
+ (addtest (test-values-from-assignment)
39
+ test-2
40
+ (ensure-same (values-from-assignment (list '(c '(a b)) '(d (list 'x 'y))))
41
+ '((a b) (x y))))
42
+
43
+ (addtest (test-values-from-assignment)
44
+ test-3
45
+ (ensure-same (values-from-assignment '((:B ((A . 1) (B . 3)) ((A . 2) (B . 4)))
46
+ (:B ((C . A) (D . X)) ((C . B) (D . Y)))))
47
+ '((1 2) (3 4) (a b) (x y))))
48
+
49
+ ;;; ---------------------------------------------------------------------------
50
+
51
+ (deftestsuite test-standardize-cases-form (test-process-cases-form)
52
+ ())
53
+
54
+ (addtest (test-standardize-cases-form)
55
+ test-1
56
+ (ensure-same
57
+ (standardize-cases-form '((q '(a b))))
58
+ '(:cross (q '(a b)))))
59
+
60
+ ;;; ---------------------------------------------------------------------------
61
+
62
+ (addtest (test-standardize-cases-form)
63
+ test-2
64
+ (ensure-same
65
+ (standardize-cases-form '((:map (a '(1 2 3 4 5)) (b '(9 8 7 6 5)))))
66
+ '(:map (a '(1 2 3 4 5)) (b '(9 8 7 6 5)))))
67
+
68
+ ;;; ---------------------------------------------------------------------------
69
+
70
+ (addtest (test-standardize-cases-form)
71
+ test-3
72
+ (ensure-same
73
+ (standardize-cases-form '((q '(a b)) (b '(1 2))))
74
+ '(:cross (q '(a b)) (b '(1 2)))))
75
+
76
+ ;;; ---------------------------------------------------------------------------
77
+
78
+ (addtest (test-process-cases-form)
79
+ test-map-0
80
+ (ensure-same
81
+ (process-cases-form :map '(c '(a b)))
82
+ '(:b ((c . a)) ((c . b)))
83
+ :test 'equal))
84
+
85
+ ;;; ---------------------------------------------------------------------------
86
+
87
+ (addtest (test-process-cases-form)
88
+ test-map1
89
+ (ensure-same
90
+ (process-cases-form :map '(c '(a b)) '(d (list 'x 'y)))
91
+ '(:b ((c . a) (d . x)) ((c . b) (d . y)))
92
+ :test 'equal))
93
+
94
+ (addtest (test-process-cases-form)
95
+ test-map2-a
96
+ (ensure-same
97
+ (process-cases-form :map
98
+ (process-cases-form :map '(a '(1 2)) '(b '(3 4)))
99
+ (process-cases-form :map '(c '(a b)) '(d '(x y))))
100
+ '(:b ((a . 1) (b . 3) (c . a) (d . x))
101
+ ((a . 2) (b . 4) (c . b) (d . y)))
102
+ :test 'equal))
103
+
104
+ (addtest (test-process-cases-form)
105
+ test-map2-a
106
+ (ensure-same
107
+ (process-cases-form :map
108
+ '(:b ((a . 1) (b . 3)) ((a . 2) (b . 4)))
109
+ '(:b ((c . a) (d . x)) ((c . b) (d . y))))
110
+ '(:b ((a . 1) (b . 3) (c . a) (d . x))
111
+ ((a . 2) (b . 4) (c . b) (d . y)))
112
+ :test 'equal))
113
+
114
+ (addtest (test-process-cases-form)
115
+ test-cross-0
116
+ (ensure-same
117
+ (process-cases-form :cross '(c '(a b)))
118
+ '(:b ((c . a)) ((c . b)))
119
+ :test 'equal))
120
+
121
+ (addtest (test-process-cases-form)
122
+ test-cross-1
123
+ (ensure-same
124
+ (process-cases-form :cross '(c '(a b)) '(d (list 'x 'y)))
125
+ '(:b
126
+ ((c . a) (d . x))
127
+ ((c . a) (d . y))
128
+ ((c . b) (d . x))
129
+ ((c . b) (d . y)))
130
+ :test 'equal))
131
+
132
+ (addtest (test-process-cases-form)
133
+ test-cross-b
134
+ (ensure-same
135
+ (process-cases-form :cross
136
+ '(:b ((a . 1) (b . 3)) ((a . 2) (b . 4)))
137
+ '(:b ((c . a) (d . x)) ((c . b) (d . y))))
138
+ '(:B
139
+ ((A . 1) (B . 3) (C . A) (D . X)) ((A . 1) (B . 3) (C . A) (D . Y))
140
+ ((A . 1) (B . 3) (C . B) (D . X)) ((A . 1) (B . 3) (C . B) (D . Y))
141
+ ((A . 1) (B . 4) (C . A) (D . X)) ((A . 1) (B . 4) (C . A) (D . Y))
142
+ ((A . 1) (B . 4) (C . B) (D . X)) ((A . 1) (B . 4) (C . B) (D . Y))
143
+ ((A . 2) (B . 3) (C . A) (D . X)) ((A . 2) (B . 3) (C . A) (D . Y))
144
+ ((A . 2) (B . 3) (C . B) (D . X)) ((A . 2) (B . 3) (C . B) (D . Y))
145
+ ((A . 2) (B . 4) (C . A) (D . X)) ((A . 2) (B . 4) (C . A) (D . Y))
146
+ ((A . 2) (B . 4) (C . B) (D . X)) ((A . 2) (B . 4) (C . B) (D . Y)))
147
+ :test 'equal))
148
+
149
+ (addtest (test-process-cases-form)
150
+ test-cross-a
151
+ (ensure-same
152
+ (process-cases-form :cross
153
+ (process-cases-form :map '(a '(1 2)) '(b '(3 4)))
154
+ (process-cases-form :map '(c '(a b)) '(d '(x y))))
155
+ '(:B
156
+ ((A . 1) (B . 3) (C . A) (D . X)) ((A . 1) (B . 3) (C . A) (D . Y))
157
+ ((A . 1) (B . 3) (C . B) (D . X)) ((A . 1) (B . 3) (C . B) (D . Y))
158
+ ((A . 1) (B . 4) (C . A) (D . X)) ((A . 1) (B . 4) (C . A) (D . Y))
159
+ ((A . 1) (B . 4) (C . B) (D . X)) ((A . 1) (B . 4) (C . B) (D . Y))
160
+ ((A . 2) (B . 3) (C . A) (D . X)) ((A . 2) (B . 3) (C . A) (D . Y))
161
+ ((A . 2) (B . 3) (C . B) (D . X)) ((A . 2) (B . 3) (C . B) (D . Y))
162
+ ((A . 2) (B . 4) (C . A) (D . X)) ((A . 2) (B . 4) (C . A) (D . Y))
163
+ ((A . 2) (B . 4) (C . B) (D . X)) ((A . 2) (B . 4) (C . B) (D . Y)))
164
+ :test 'equal))
165
+
166
+
167
+ ;;; ---------------------------------------------------------------------------
168
+ ;;; some simple "real" tests
169
+ ;;; ---------------------------------------------------------------------------
170
+
171
+ (deftestsuite test-addition ()
172
+ (a b)
173
+ (:cases (:map (a '(1 2 3 4 5))
174
+ (b '(9 8 7 6 5))))
175
+ (:test ((ensure-same (+ a b) 10 :test '=))))
176
+
177
+ (deftestsuite test-addition ()
178
+ (a b)
179
+ (:cases (a '(1 2 3 4 5))
180
+ (b '(9 8 7 6 5)))
181
+ (:test ((ensure-same (+ a b) (+ b a) :test '=))))
182
+
183
+ ;;; ---------------------------------------------------------------------------
184
+ ;;;
185
+ ;;; ---------------------------------------------------------------------------
186
+
187
+ (deftestsuite test-case-generation-simple-helper ()
188
+ (a)
189
+ (:cases (a '(1 2 3)))
190
+ (:test (test-1 (push a *test-scratchpad*))))
191
+
192
+ (addtest (test-case-generation-simple)
193
+ single-var-three-cases
194
+ (let ((tr (run-test (test-case-generation-simple-helper) test-1)))
195
+ (ensure-same (length (tests-run tr)) 3)
196
+ (ensure-same *test-scratchpad* '(3 2 1))))
197
+
198
+ ;;; ---------------------------------------------------------------------------
199
+
200
+ (deftestsuite test-case-generation-simple-helper-2 (test-case-generation-simple-helper)
201
+ (b)
202
+ (:cases (b '(4 5)))
203
+ (:test (test-1 (push a *test-scratchpad*)
204
+ (push b *test-scratchpad*))))
205
+
206
+ (addtest (test-case-generation-simple)
207
+ single-var-with-superclass
208
+ (let ((tr (run-test (test-case-generation-simple-helper-2) test-1)))
209
+ (ensure-same (length (tests-run tr)) 6)
210
+ (ensure-same *test-scratchpad* '(1 4 1 5 2 4 2 5 3 4 3 5))))
211
+
212
+ ;;; ---------------------------------------------------------------------------
213
+
214
+ (deftestsuite test-case-generation-simple-helper-3 ()
215
+ (a b)
216
+ (:cases (a '(1 2 3))
217
+ (b '(4 5)))
218
+ (:test (test-1 (push (list a b) *test-scratchpad*))))
219
+
220
+ (addtest (test-case-generation-simple)
221
+ two-vars-cross-product
222
+ (let ((tr (run-test (test-case-generation-simple-helper-3) test-1)))
223
+ (ensure-same (length (tests-run tr)) 6)
224
+ (ensure-same *test-scratchpad* '((1 4) (1 5) (2 4) (2 5) (3 4) (3 5)))))
225
+
226
+ ;;; ---------------------------------------------------------------------------
227
+
228
+ (deftestsuite test-case-generation-simple-helper-4 ()
229
+ (a b)
230
+ (:cases (:map (a (1 2 3))
231
+ (b (4 5 6))))
232
+ (:test (test-1 (push (list a b) *test-scratchpad*))))
233
+
234
+ (addtest (test-case-generation-simple)
235
+ two-vars-mapping
236
+ (let ((tr (run-test (test-case-generation-simple-helper) test-1)))
237
+ (ensure-same (length (tests-run tr)) 3)
238
+ (ensure-same *test-scratchpad* '(3 2 1))))
239
+
240
+ ;;; ---------------------------------------------------------------------------
241
+
242
+ (defun random-integers (count)
243
+ (loop repeat count collect
244
+ (variates:integer-random variates:*random-generator* -9 10)))
245
+
246
+ (deftestsuite test-case-generation-simple-helper-5 ()
247
+ (a b)
248
+ (:cases (a (random-integers 3))
249
+ (b (random-integers 2)))
250
+ (:test (test-1 (push (list a b) *test-scratchpad*))))
251
+
252
+ (addtest (test-case-generation-simple)
253
+ two-vars-cross-product-run-time
254
+ (let ((tr (run-test (test-case-generation-simple-helper-5) test-1)))
255
+ (ensure-same (length (tests-run tr)) 6)))
256
+
257
+ ;;; ---------------------------------------------------------------------------
258
+ ;;;
259
+ ;;; ---------------------------------------------------------------------------
260
+
261
+ (deftestsuite test-case-generation-helper-1 ()
262
+ (a)
263
+ (:cases (a :exemplars-of fixnum))
264
+ (:test (test-1 (push (list a) *test-scratchpad*))))
265
+
266
+ ;;; ---------------------------------------------------------------------------
267
+
268
+ (deftestsuite test-case-generation-helper-2 ()
269
+ (a)
270
+ (:cases (a :samples-from standard-normal))
271
+ (:test (test-1 (push (list a) *test-scratchpad*))))
272
+
273
+ ;;; ---------------------------------------------------------------------------
274
+
275
+ (deftestsuite test-case-generation-helper-3 ()
276
+ (a)
277
+ (:cases (a :samples-from fixnum))
278
+ (:test (test-1 (push (list a) *test-scratchpad*))))
@@ -0,0 +1,37 @@
1
+ (in-package #:lift-test)
2
+
3
+ (deftestsuite test-lift-timeouts (lift-test)
4
+ ())
5
+
6
+ (deftestsuite test-timeout-helper ()
7
+ ()
8
+ :timeout 1)
9
+
10
+ (addtest (test-timeout-helper)
11
+ success-1
12
+ (ensure t))
13
+
14
+ (addtest (test-timeout-helper)
15
+ timeout-1
16
+ (sleep 2)
17
+ (ensure t))
18
+
19
+
20
+
21
+
22
+ #|
23
+
24
+ (deftestsuite test-timeout ()
25
+ ()
26
+ (:timeout 1))
27
+
28
+ (addtest (test-timeout)
29
+ test-should-pass
30
+ (sleep 0.5)
31
+ (ensure t))
32
+
33
+ (addtest (test-timeout)
34
+ test-should-fail
35
+ (sleep 1.5)
36
+ (ensure t))
37
+ |#
@@ -0,0 +1,62 @@
1
+ (in-package #:lift-test)
2
+
3
+ ;;;;;;;;;;;;;;;;;;
4
+
5
+ (deftestsuite setup-and-slots-hierarchy-parent ()
6
+ ((slot-parent (progn (push :slot-parent *test-scratchpad*) :a)))
7
+ :setup (push :setup-parent *test-scratchpad*)
8
+ :teardown (push :teardown-parent *test-scratchpad*))
9
+
10
+ (deftestsuite setups-and-slots-hierarchy-child
11
+ (setup-and-slots-hierarchy-parent)
12
+ ((slot-child (progn (push :slot-child *test-scratchpad*) :a)))
13
+ :setup (push :setup-child *test-scratchpad*)
14
+ :teardown (push :teardown-child *test-scratchpad*))
15
+
16
+
17
+
18
+ ;;;;;;;;;;;;;;;;;;;;;
19
+
20
+ (run-test :break-on-errors? t)
21
+
22
+ (deftestsuite warnings-and-errors ()
23
+ ())
24
+
25
+ (defun warnings-and-errors-function (mode)
26
+ (ecase mode
27
+ (:warn (warn "this is a warning all by itself"))
28
+ (:error (error "this is an error all by itself"))
29
+ (:warn-error (warn "first we warn") (error "then we error"))
30
+ (:error-warn (error "first we error") (warn "then we warn"))))
31
+
32
+ (addtest (warnings-and-errors)
33
+ warning-does-not-hide-error-1
34
+ (ensure-error (warnings-and-errors-function :warn-error)))
35
+
36
+ (addtest (warnings-and-errors)
37
+ warning-does-not-hide-error-2
38
+ (ensure-warning (warnings-and-errors-function :warn-error)))
39
+
40
+ (addtest (warnings-and-errors)
41
+ just-error
42
+ ;; the error is eaten even when you run the test with break-on-errors? t
43
+ (ensure-error (warnings-and-errors-function :error)))
44
+
45
+ (addtest (warnings-and-errors)
46
+ just-error
47
+ ;; the error is eaten even when you run the test with break-on-errors? t
48
+ (warnings-and-errors-function :error))
49
+
50
+ ;;;;;;
51
+
52
+
53
+ (deftestsuite tests-20081021b ()
54
+ ((foo "123")
55
+ (bar "456"))
56
+ (:setup
57
+ (print (list :te-a lift::*test-environment*))
58
+ (print (list foo bar))))
59
+
60
+ (addtest (tests-20081021b)
61
+ test-1
62
+ (print foo))
@@ -0,0 +1,60 @@
1
+ (in-package #:lift-test)
2
+
3
+ (defvar *expect-error* nil)
4
+
5
+ (deftestsuite expect-error (lift-test)
6
+ ())
7
+
8
+ (deftestsuite expect-error-helper ()
9
+ ()
10
+ (:expected-error *expect-error*))
11
+
12
+ (addtest (expect-error-helper)
13
+ test-1
14
+ (error "this is an error"))
15
+
16
+ (addtest (expect-error)
17
+ test-expects-error
18
+ (let* ((*expect-error* t)
19
+ (result (run-tests :suite 'expect-error-helper)))
20
+ (ensure-same (lift::suites-run result) '(expect-error-helper) :test 'equal)
21
+ (ensure-same (length (tests-run result)) 1)
22
+ (ensure-same (length (errors result)) 0 :test '=)))
23
+
24
+ (addtest (expect-error)
25
+ test-does-not-expect-error
26
+ (let* ((*expect-error* nil)
27
+ (result (run-tests :suite 'expect-error-helper)))
28
+ (ensure-same (length (errors result)) 1 :test '=)))
29
+
30
+ ;;;;
31
+
32
+ (defvar *expect-failure* nil)
33
+
34
+ (deftestsuite expect-failure (lift-test)
35
+ ())
36
+
37
+ (deftestsuite expect-failure-helper ()
38
+ ()
39
+ (:expected-failure *expect-failure*))
40
+
41
+ (addtest (expect-failure-helper)
42
+ test-1
43
+ (ensure-null "this is an failure"))
44
+
45
+ (addtest (expect-failure)
46
+ test-expects-failure
47
+ (let* ((*expect-failure* t)
48
+ (result (run-tests :suite 'expect-failure-helper)))
49
+ (ensure-same (lift::suites-run result)
50
+ '(expect-failure-helper) :test 'equal)
51
+ (ensure-same (length (tests-run result)) 1)
52
+ (ensure-same (length (failures result)) 0 :test '=)))
53
+
54
+ (addtest (expect-failure)
55
+ test-does-not-expect-failure
56
+ (let* ((*expect-failure* nil)
57
+ (result (run-tests :suite 'expect-failure-helper)))
58
+ (ensure-same (length (failures result)) 1 :test '=)))
59
+
60
+
@@ -0,0 +1,13 @@
1
+ (in-package #:common-lisp-user)
2
+
3
+ (unless (and (find-package '#:com.metabang.trivial-timeout)
4
+ (find-symbol (symbol-name '#:with-timeout)
5
+ '#:com.metabang.trivial-timeout)
6
+ (fboundp (find-symbol (symbol-name '#:with-timeout)
7
+ '#:com.metabang.trivial-timeout)))
8
+ (defpackage #:com.metabang.trivial-timeout
9
+ (:use #:common-lisp)
10
+ (:nicknames #:trivial-timeout)
11
+ (:export
12
+ #:with-timeout
13
+ #:timeout-error)))