clucumber 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +4 -9
- data/lib/clucumber/clucumber-bootstrap.lisp +32 -0
- data/lib/clucumber/vendor/cl-interpol/alias.lisp +55 -0
- data/lib/clucumber/vendor/cl-interpol/cl-interpol.asd +56 -0
- data/lib/clucumber/vendor/cl-interpol/load.lisp +53 -0
- data/lib/clucumber/vendor/cl-interpol/packages.lisp +40 -0
- data/lib/clucumber/vendor/cl-interpol/read.lisp +716 -0
- data/lib/clucumber/vendor/cl-interpol/specials.lisp +113 -0
- data/lib/clucumber/vendor/cl-interpol/test/packages.lisp +34 -0
- data/lib/clucumber/vendor/cl-interpol/test/tests.lisp +128 -0
- data/lib/clucumber/vendor/cl-interpol/test.lisp +177 -0
- data/lib/clucumber/vendor/cl-interpol/test2.lisp +6254 -0
- data/lib/clucumber/vendor/cl-interpol/unicode.lisp +13912 -0
- data/lib/clucumber/vendor/cl-interpol/util.lisp +122 -0
- data/lib/clucumber/vendor/cl-ppcre/api.lisp +1262 -0
- data/lib/clucumber/vendor/cl-ppcre/charmap.lisp +152 -0
- data/lib/clucumber/vendor/cl-ppcre/charset.lisp +242 -0
- data/lib/clucumber/vendor/cl-ppcre/chartest.lisp +98 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-test.asd +34 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/packages.lisp +38 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/resolver.lisp +61 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode.asd +58 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre.asd +79 -0
- data/lib/clucumber/vendor/cl-ppcre/closures.lisp +471 -0
- data/lib/clucumber/vendor/cl-ppcre/convert.lisp +875 -0
- data/lib/clucumber/vendor/cl-ppcre/errors.lisp +84 -0
- data/lib/clucumber/vendor/cl-ppcre/lexer.lisp +737 -0
- data/lib/clucumber/vendor/cl-ppcre/lispworks-defsystem.lisp +57 -0
- data/lib/clucumber/vendor/cl-ppcre/load.lisp +67 -0
- data/lib/clucumber/vendor/cl-ppcre/optimize.lisp +578 -0
- data/lib/clucumber/vendor/cl-ppcre/packages.lisp +68 -0
- data/lib/clucumber/vendor/cl-ppcre/parser.lisp +319 -0
- data/lib/clucumber/vendor/cl-ppcre/ppcre-tests.lisp +269 -0
- data/lib/clucumber/vendor/cl-ppcre/regex-class-util.lisp +555 -0
- data/lib/clucumber/vendor/cl-ppcre/regex-class.lisp +259 -0
- data/lib/clucumber/vendor/cl-ppcre/repetition-closures.lisp +833 -0
- data/lib/clucumber/vendor/cl-ppcre/scanner.lisp +506 -0
- data/lib/clucumber/vendor/cl-ppcre/specials.lisp +172 -0
- data/lib/clucumber/vendor/cl-ppcre/test/packages.lisp +37 -0
- data/lib/clucumber/vendor/cl-ppcre/test/perl-tests.lisp +150 -0
- data/lib/clucumber/vendor/cl-ppcre/test/tests.lisp +159 -0
- data/lib/clucumber/vendor/cl-ppcre/test/unicode-tests.lisp +80 -0
- data/lib/clucumber/vendor/cl-ppcre/util.lisp +201 -0
- data/lib/clucumber/vendor/cl-unicode/alias.lisp +135 -0
- data/lib/clucumber/vendor/cl-unicode/api.lisp +412 -0
- data/lib/clucumber/vendor/cl-unicode/build/char-info.lisp +133 -0
- data/lib/clucumber/vendor/cl-unicode/build/dump.lisp +239 -0
- data/lib/clucumber/vendor/cl-unicode/build/read.lisp +280 -0
- data/lib/clucumber/vendor/cl-unicode/build/util.lisp +182 -0
- data/lib/clucumber/vendor/cl-unicode/cl-unicode.asd +90 -0
- data/lib/clucumber/vendor/cl-unicode/conditions.lisp +54 -0
- data/lib/clucumber/vendor/cl-unicode/derived.lisp +120 -0
- data/lib/clucumber/vendor/cl-unicode/hash-tables.lisp +20 -0
- data/lib/clucumber/vendor/cl-unicode/lists.lisp +10 -0
- data/lib/clucumber/vendor/cl-unicode/methods.lisp +15 -0
- data/lib/clucumber/vendor/cl-unicode/packages.lisp +76 -0
- data/lib/clucumber/vendor/cl-unicode/specials.lisp +135 -0
- data/lib/clucumber/vendor/cl-unicode/test/packages.lisp +34 -0
- data/lib/clucumber/vendor/cl-unicode/test/tests.lisp +150 -0
- data/lib/clucumber/vendor/cl-unicode/test-functions.lisp +94 -0
- data/lib/clucumber/vendor/cl-unicode/util.lisp +274 -0
- data/lib/clucumber/vendor/lift/compare/fiveam-tests.lisp +14 -0
- data/lib/clucumber/vendor/lift/compare/lift-tests.lisp +13 -0
- data/lib/clucumber/vendor/lift/compare/rt-tests.lisp +16 -0
- data/lib/clucumber/vendor/lift/compare/xlunit-tests.lisp +15 -0
- data/lib/clucumber/vendor/lift/dev/changes.lisp +61 -0
- data/lib/clucumber/vendor/lift/dev/config.lisp +354 -0
- data/lib/clucumber/vendor/lift/dev/copy-file.lisp +117 -0
- data/lib/clucumber/vendor/lift/dev/introspection.lisp +232 -0
- data/lib/clucumber/vendor/lift/dev/lift-interface.lisp +56 -0
- data/lib/clucumber/vendor/lift/dev/lift-notes.lisp +202 -0
- data/lib/clucumber/vendor/lift/dev/lift-randomized.lisp +45 -0
- data/lib/clucumber/vendor/lift/dev/lift.lisp +2383 -0
- data/lib/clucumber/vendor/lift/dev/macros.lisp +229 -0
- data/lib/clucumber/vendor/lift/dev/measuring.lisp +156 -0
- data/lib/clucumber/vendor/lift/dev/packages.lisp +161 -0
- data/lib/clucumber/vendor/lift/dev/port.lisp +151 -0
- data/lib/clucumber/vendor/lift/dev/prototypes.lisp +282 -0
- data/lib/clucumber/vendor/lift/dev/random-testing.lisp +124 -0
- data/lib/clucumber/vendor/lift/dev/report-locations.lisp +13 -0
- data/lib/clucumber/vendor/lift/dev/reports.lisp +916 -0
- data/lib/clucumber/vendor/lift/dev/utilities.lisp +242 -0
- data/lib/clucumber/vendor/lift/docs/package.lisp +6 -0
- data/lib/clucumber/vendor/lift/docs/setup.lisp +17 -0
- data/lib/clucumber/vendor/lift/examples/basic-examples.lisp +289 -0
- data/lib/clucumber/vendor/lift/examples/random-testing.lisp +32 -0
- data/lib/clucumber/vendor/lift/lift-documentation.asd +28 -0
- data/lib/clucumber/vendor/lift/lift-test.asd +35 -0
- data/lib/clucumber/vendor/lift/lift.asd +77 -0
- data/lib/clucumber/vendor/lift/test/equality-tests.lisp +40 -0
- data/lib/clucumber/vendor/lift/test/finding-tests.lisp +32 -0
- data/lib/clucumber/vendor/lift/test/lift-test.lisp +783 -0
- data/lib/clucumber/vendor/lift/test/order-of-operations.lisp +54 -0
- data/lib/clucumber/vendor/lift/test/packages.lisp +17 -0
- data/lib/clucumber/vendor/lift/test/test-config-files.lisp +20 -0
- data/lib/clucumber/vendor/lift/test/test-dynamic-variables.lisp +57 -0
- data/lib/clucumber/vendor/lift/test/test-maximum-problems.lisp +74 -0
- data/lib/clucumber/vendor/lift/test/test-prototypes.lisp +278 -0
- data/lib/clucumber/vendor/lift/test/test-timeout.lisp +37 -0
- data/lib/clucumber/vendor/lift/test/tests-in-progress.lisp +62 -0
- data/lib/clucumber/vendor/lift/test/testsuite-expects.lisp +60 -0
- data/lib/clucumber/vendor/lift/timeout/package.lisp +13 -0
- data/lib/clucumber/vendor/lift/timeout/with-timeout.lisp +123 -0
- data/lib/clucumber/vendor/lift/website/stuff/Temp.lisp +34 -0
- data/lib/clucumber/vendor/st-json/st-json.asd +3 -0
- data/lib/clucumber/vendor/st-json/st-json.lisp +310 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/backtrace.lisp +127 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/fallback.lisp +10 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/map-backtrace.lisp +103 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/mucking.lisp +75 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/packages.lisp +13 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/utilities.lisp +104 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/packages.lisp +5 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/test-setup.lisp +4 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/tests.lisp +16 -0
- data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace-test.asd +22 -0
- data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace.asd +35 -0
- data/lib/clucumber/vendor/usocket/backend/allegro.lisp +199 -0
- data/lib/clucumber/vendor/usocket/backend/armedbear.lisp +491 -0
- data/lib/clucumber/vendor/usocket/backend/clisp.lisp +260 -0
- data/lib/clucumber/vendor/usocket/backend/cmucl.lisp +266 -0
- data/lib/clucumber/vendor/usocket/backend/lispworks.lisp +741 -0
- data/lib/clucumber/vendor/usocket/backend/mcl.lisp +369 -0
- data/lib/clucumber/vendor/usocket/backend/openmcl.lisp +206 -0
- data/lib/clucumber/vendor/usocket/backend/sbcl.lisp +424 -0
- data/lib/clucumber/vendor/usocket/backend/scl.lisp +261 -0
- data/lib/clucumber/vendor/usocket/condition.lisp +227 -0
- data/lib/clucumber/vendor/usocket/package.lisp +82 -0
- data/lib/clucumber/vendor/usocket/server.lisp +45 -0
- data/lib/clucumber/vendor/usocket/test/package.lisp +13 -0
- data/lib/clucumber/vendor/usocket/test/test-usocket.lisp +166 -0
- data/lib/clucumber/vendor/usocket/usocket-test.asd +26 -0
- data/lib/clucumber/vendor/usocket/usocket.asd +37 -0
- data/lib/clucumber/vendor/usocket/usocket.lisp +542 -0
- data/lib/clucumber/vendor/usocket/vendor/kqueue.lisp +1 -0
- data/lib/clucumber/vendor/usocket/vendor/split-sequence.lisp +245 -0
- data/lib/clucumber.rb +29 -7
- metadata +151 -5
@@ -0,0 +1,113 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-interpol/specials.lisp,v 1.12 2008/07/23 13:58:40 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2003-2008, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package :cl-interpol)
|
31
|
+
|
32
|
+
(defvar *list-delimiter* #\Space
|
33
|
+
"What is inserted between the elements of a list which is
|
34
|
+
interpolated by #\@.")
|
35
|
+
|
36
|
+
(defvar *inner-delimiters* '((#\( . #\))
|
37
|
+
(#\{ . #\})
|
38
|
+
(#\< . #\>)
|
39
|
+
(#\[ . #\]))
|
40
|
+
"Legal delimiters for interpolation with #\$ and #\@.")
|
41
|
+
|
42
|
+
(defvar *outer-delimiters* '((#\( . #\))
|
43
|
+
(#\{ . #\})
|
44
|
+
(#\< . #\>)
|
45
|
+
(#\[ . #\])
|
46
|
+
#\/ #\| #\" #\' #\#)
|
47
|
+
"Legal outer delimiters for CL-INTERPOL strings.")
|
48
|
+
|
49
|
+
(defvar *regex-delimiters* '(#\/)
|
50
|
+
"Outer delimiters which automatically enable regex mode.")
|
51
|
+
|
52
|
+
(defvar *unicode-aliases*
|
53
|
+
(make-hash-table :test #'equalp)
|
54
|
+
"A hash table which maps Unicode aliases to their real names.")
|
55
|
+
|
56
|
+
(defvar *optional-delimiters-p* nil
|
57
|
+
"Whether text following $ or @ should interpolate even without a
|
58
|
+
following delimiter. Lexical variables are handled correctly,
|
59
|
+
but the rules are somewhat complex -- see the docs for details.")
|
60
|
+
|
61
|
+
(defmacro defvar-unbound (variable-name documentation)
|
62
|
+
"Like DEFVAR, but the variable will be unbound rather than getting
|
63
|
+
an initial value. This is useful for variables which should have no
|
64
|
+
global value but might have a dynamically bound value."
|
65
|
+
;; stolen from comp.lang.lisp article <k7727i3s.fsf@comcast.net> by
|
66
|
+
;; "prunesquallor@comcast.net"
|
67
|
+
`(eval-when (:load-toplevel :compile-toplevel :execute)
|
68
|
+
(defvar ,variable-name)
|
69
|
+
(setf (documentation ',variable-name 'variable)
|
70
|
+
,documentation)))
|
71
|
+
|
72
|
+
(defvar-unbound *saw-backslash*
|
73
|
+
"Whether we have to re-process an \L or \U because it closes several
|
74
|
+
scopes.")
|
75
|
+
|
76
|
+
(defvar-unbound *pair-level*
|
77
|
+
"")
|
78
|
+
|
79
|
+
(defvar-unbound *stream*
|
80
|
+
"Bound to the stream which is read from while parsing a string.")
|
81
|
+
|
82
|
+
(defvar-unbound *start-char*
|
83
|
+
"Bound to the opening outer delimiter while parsing a string.")
|
84
|
+
|
85
|
+
(defvar-unbound *term-char*
|
86
|
+
"Bound to the closing outer delimiter while parsing a string.")
|
87
|
+
|
88
|
+
(defvar *previous-readtables* nil
|
89
|
+
"A stack which holds the previous readtables that have been pushed
|
90
|
+
here by ENABLE-INTERPOL-SYNTAX.")
|
91
|
+
|
92
|
+
(defvar-unbound *readtable-copy*
|
93
|
+
"Bound to the current readtable if it has to be temporarily
|
94
|
+
modified.")
|
95
|
+
|
96
|
+
;; stuff for Nikodemus Siivola's HYPERDOC
|
97
|
+
;; see <http://common-lisp.net/project/hyperdoc/>
|
98
|
+
;; and <http://www.cliki.net/hyperdoc>
|
99
|
+
|
100
|
+
(defvar *hyperdoc-base-uri* "http://weitz.de/cl-interpol/")
|
101
|
+
|
102
|
+
(let ((exported-symbols-alist
|
103
|
+
(loop for symbol being the external-symbols of :cl-interpol
|
104
|
+
collect (cons symbol
|
105
|
+
(concatenate 'string
|
106
|
+
"#"
|
107
|
+
(string-downcase symbol))))))
|
108
|
+
(defun hyperdoc-lookup (symbol type)
|
109
|
+
(declare (ignore type))
|
110
|
+
(cdr (assoc symbol
|
111
|
+
exported-symbols-alist
|
112
|
+
:test #'eq))))
|
113
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-interpol/test/packages.lisp,v 1.2 2008/07/23 13:58:44 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2002-2008, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package :cl-user)
|
31
|
+
|
32
|
+
(defpackage :cl-interpol-test
|
33
|
+
(:use :cl :cl-interpol :cl-unicode)
|
34
|
+
(:export :run-all-tests))
|
@@ -0,0 +1,128 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL-TEST; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-interpol/test/tests.lisp,v 1.4 2008/07/23 16:10:13 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2008, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package :cl-interpol-test)
|
31
|
+
|
32
|
+
(defvar *this-file* (load-time-value
|
33
|
+
(or #.*compile-file-pathname* *load-pathname*))
|
34
|
+
"The location of this source file. Needed to find the data files.")
|
35
|
+
|
36
|
+
(defmacro do-tests ((name &optional show-progress-p) &body body)
|
37
|
+
"Helper macro which repeatedly executes BODY until the code in body
|
38
|
+
calls the function DONE. It is assumed that each invocation of BODY
|
39
|
+
will be the execution of one test which returns NIL in case of success
|
40
|
+
and a list of strings describing errors otherwise.
|
41
|
+
|
42
|
+
The macro prints a simple progress indicator \(one dots for ten tests)
|
43
|
+
to *STANDARD-OUTPUT* unless SHOW-PROGRESS-P is NIL and returns a true
|
44
|
+
value iff all tests succeeded. Errors in BODY are caught and reported
|
45
|
+
\(and counted as failures)."
|
46
|
+
`(let ((successp t)
|
47
|
+
(testcount 1))
|
48
|
+
(block test-block
|
49
|
+
(flet ((done ()
|
50
|
+
(return-from test-block successp)))
|
51
|
+
(format t "~&Test: ~A~%" ,name)
|
52
|
+
(loop
|
53
|
+
(when (and ,show-progress-p (zerop (mod testcount 10)))
|
54
|
+
(format t ".")
|
55
|
+
(when (zerop (mod testcount 100))
|
56
|
+
(terpri))
|
57
|
+
(force-output))
|
58
|
+
(let ((errors
|
59
|
+
(handler-case
|
60
|
+
(progn ,@body)
|
61
|
+
(error (msg)
|
62
|
+
(list (format nil "~&got an unexpected error: ~A" msg))))))
|
63
|
+
(setq successp (and successp (null errors)))
|
64
|
+
(when errors
|
65
|
+
(format t "~&~4@A:~{~& ~A~}~%" testcount errors))
|
66
|
+
(incf testcount)))))
|
67
|
+
successp))
|
68
|
+
|
69
|
+
(defun simple-tests (&key (file-name
|
70
|
+
(make-pathname :name "simple"
|
71
|
+
:type nil :version nil
|
72
|
+
:defaults *this-file*))
|
73
|
+
(external-format '(:latin-1 :eol-style :lf))
|
74
|
+
verbose)
|
75
|
+
"Loops through all the forms in the file FILE-NAME and executes each
|
76
|
+
of them using EVAL. The CL-INTERPOL syntax is enabled when the forms
|
77
|
+
are read. It is assumed that each FORM specifies a test which returns
|
78
|
+
a true value iff it succeeds. Prints each test form to
|
79
|
+
*STANDARD-OUTPUT* if VERBOSE is true and shows a simple progress
|
80
|
+
indicator otherwise. EXTERNAL-FORMAT is the FLEXI-STREAMS external
|
81
|
+
format which is used to read the file. Returns a true value iff all
|
82
|
+
tests succeeded.
|
83
|
+
|
84
|
+
\(SETQ ...) forms are treated special in that they're just EVALuated
|
85
|
+
but not counted as tests. The global special variables exported by
|
86
|
+
CL-INTERPOL \(and some from CL-UNICODE as well) are rebound during the
|
87
|
+
tests so that they can be safely set in the test files."
|
88
|
+
(enable-interpol-syntax)
|
89
|
+
(unwind-protect
|
90
|
+
(with-open-file (binary-stream file-name :element-type 'flex:octet)
|
91
|
+
(let* ((stream (flex:make-flexi-stream binary-stream :external-format external-format))
|
92
|
+
(*package* (find-package :cl-interpol-test))
|
93
|
+
(*list-delimiter* *list-delimiter*)
|
94
|
+
(*outer-delimiters* *outer-delimiters*)
|
95
|
+
(*inner-delimiters* *inner-delimiters*)
|
96
|
+
(*optional-delimiters-p* *optional-delimiters-p*)
|
97
|
+
(*scripts-to-try* *scripts-to-try*)
|
98
|
+
(*try-abbreviations-p* *try-abbreviations-p*)
|
99
|
+
(*try-hex-notation-p* *try-hex-notation-p*)
|
100
|
+
(*try-lisp-names-p* *try-lisp-names-p*)
|
101
|
+
(*try-unicode1-names-p* *try-unicode1-names-p*))
|
102
|
+
(do-tests ((format nil "Simple tests from file ~S" (file-namestring file-name))
|
103
|
+
(not verbose))
|
104
|
+
(let* ((form (or (read stream nil) (done)))
|
105
|
+
(setqp (eq (first form) 'setq)))
|
106
|
+
(when (and verbose (not setqp))
|
107
|
+
(format t "~&~S" form))
|
108
|
+
(cond (setqp (eval form) nil)
|
109
|
+
((eval form) nil)
|
110
|
+
(t (list (format nil "~S returned NIL" form))))))))
|
111
|
+
(disable-interpol-syntax)))
|
112
|
+
|
113
|
+
(defun run-all-tests (&key verbose)
|
114
|
+
"Runs all tests for CL-INTERPOL and returns a true value iff all
|
115
|
+
tests succeeded. VERBOSE is interpreted by the individual test suites
|
116
|
+
above."
|
117
|
+
(let ((successp t))
|
118
|
+
(macrolet ((run-test-suite (&body body)
|
119
|
+
`(unless (progn ,@body)
|
120
|
+
(setq successp nil))))
|
121
|
+
;; run the automatically generated Perl tests
|
122
|
+
(run-test-suite (simple-tests :file-name (make-pathname :name "perltests"
|
123
|
+
:type nil :version nil
|
124
|
+
:defaults *this-file*)
|
125
|
+
:verbose verbose))
|
126
|
+
(run-test-suite (simple-tests :verbose verbose)))
|
127
|
+
(format t "~2&~:[Some tests failed~;All tests passed~]." successp)
|
128
|
+
successp))
|
@@ -0,0 +1,177 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-interpol/test.lisp,v 1.9 2004/04/24 00:19:13 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package #:cl-interpol)
|
31
|
+
|
32
|
+
;; Otherwise it's impossible to see which tests are failing for all
|
33
|
+
;; the "helpful" warnings.
|
34
|
+
#+sbcl (declaim (optimize (sb-ext:inhibit-warnings 3)))
|
35
|
+
|
36
|
+
(defvar *temp*)
|
37
|
+
|
38
|
+
(defparameter *cl-interpol-base-directory*
|
39
|
+
(make-pathname :name nil :type nil :version nil
|
40
|
+
:defaults (parse-namestring *load-truename*)))
|
41
|
+
|
42
|
+
(defparameter *test-counter* 0)
|
43
|
+
|
44
|
+
(defparameter *failure-counter* 0)
|
45
|
+
|
46
|
+
(defun test (form1 form2)
|
47
|
+
(unless (string= form1 form2)
|
48
|
+
(incf *failure-counter*)
|
49
|
+
(format t "~&Test ~A failed: Expected ~S but got ~S~%"
|
50
|
+
(1+ *test-counter*) form2 form1))
|
51
|
+
(incf *test-counter*)
|
52
|
+
(princ #\.)
|
53
|
+
(when (zerop (mod *test-counter* 10))
|
54
|
+
(princ #\Space)
|
55
|
+
(princ *test-counter*)
|
56
|
+
(terpri))
|
57
|
+
(force-output))
|
58
|
+
|
59
|
+
(enable-interpol-syntax)
|
60
|
+
|
61
|
+
(test #?"abc" "abc")
|
62
|
+
(test #?'abc' "abc")
|
63
|
+
(test #?|abc| "abc")
|
64
|
+
(test #?/abc/ "abc")
|
65
|
+
(test #?#abc# "abc")
|
66
|
+
(test #?{abc} "abc")
|
67
|
+
(test #?(abc) "abc")
|
68
|
+
(test #?<abc> "abc")
|
69
|
+
(test #?[abc] "abc")
|
70
|
+
(test #?"\t\n\r\f\b\a\e"
|
71
|
+
(coerce (list #\Tab #\Newline #\Return #\Page #\Backspace (code-char 7) (code-char 27))
|
72
|
+
'string))
|
73
|
+
(test #?"\033\x1b\c[\x{1b}"
|
74
|
+
(make-string 4 :initial-element (code-char 27)))
|
75
|
+
(test #?"\x" (string (code-char 0)))
|
76
|
+
(test #?"\x001" (format nil "~A1" (code-char 0)))
|
77
|
+
(test #?"\0001" (format nil "~A1" (code-char 0)))
|
78
|
+
|
79
|
+
(eval-when (:compile-toplevel :load-toplevel :execute)
|
80
|
+
(setq *temp* (list *long-unicode-names-p*
|
81
|
+
*short-unicode-names-p*
|
82
|
+
*unicode-scripts*)
|
83
|
+
*long-unicode-names-p* t))
|
84
|
+
|
85
|
+
(test #?"\N{LATIN CAPITAL LETTER A WITH DIAERESIS}" "�")
|
86
|
+
(test #?"\N{latin capital letter a with diaeresis}" "�")
|
87
|
+
(test #?{\N{LATIN CAPITAL LETTER A WITH DIAERESIS}} "�")
|
88
|
+
|
89
|
+
(eval-when (:compile-toplevel :load-toplevel :execute)
|
90
|
+
(setq *short-unicode-names-p* t))
|
91
|
+
|
92
|
+
(test #?"\N{Latin:A with Diaeresis}" "�")
|
93
|
+
(test #?"\N{Latin:a with diaeresis}" "�")
|
94
|
+
|
95
|
+
(eval-when (:compile-toplevel :load-toplevel :execute)
|
96
|
+
(setq *unicode-scripts* (list "Latin")))
|
97
|
+
|
98
|
+
(test #?"\N{A with Diaeresis}" "�")
|
99
|
+
(test #?"\N{a with diaeresis}" "�")
|
100
|
+
|
101
|
+
(eval-when (:compile-toplevel :load-toplevel :execute)
|
102
|
+
(setq *long-unicode-names-p* (first *temp*)
|
103
|
+
*short-unicode-names-p* (second *temp*)
|
104
|
+
*unicode-scripts* (third *temp*)))
|
105
|
+
|
106
|
+
(test #?/\1/ "\\1")
|
107
|
+
(test #?r"\1" "\\1")
|
108
|
+
(test #?x/abc / "abc")
|
109
|
+
(test #?x/abc
|
110
|
+
/ "abc")
|
111
|
+
(test #?rx"abc " "abc")
|
112
|
+
(test #?/[\1]\1/ (format nil "[~A]\\1" (code-char 1)))
|
113
|
+
(test #?/[(?#foo)](?#foo)/ "[(?#foo)]")
|
114
|
+
(test #?/a#bc/ "a#bc")
|
115
|
+
(test #?x/a#bc/ "a")
|
116
|
+
(test #?x/\d\A[\d\A]/ "\\d\\A[\\dA]")
|
117
|
+
|
118
|
+
(test #?"\Q-" "\\-")
|
119
|
+
(test #?"\Q-\E-" "\\--")
|
120
|
+
(test #?"\ufoo" "Foo")
|
121
|
+
(test #?"\Ufoo" "FOO")
|
122
|
+
(test #?"\Ufoo\Ebar" "FOObar")
|
123
|
+
(test #?"\Ufoo\LBAR" "FOObar")
|
124
|
+
|
125
|
+
(let ((a "foo"))
|
126
|
+
(test #?"$" "$")
|
127
|
+
(test #?"@ @" "@ @")
|
128
|
+
(test #?"${a}bar" "foobar")
|
129
|
+
(test #?/${a}bar/ "foobar")
|
130
|
+
(test #?"$[a]bar" "foobar")
|
131
|
+
(test #?"$(a)bar" "foobar")
|
132
|
+
(test #?"$<a>bar" "foobar")
|
133
|
+
(test #?/$<a>bar/ "$<a>bar")
|
134
|
+
(test #?"$a @a " "$a @a "))
|
135
|
+
|
136
|
+
(let ((a (list 1 2 3)))
|
137
|
+
(test #?"${a}" "(1 2 3)")
|
138
|
+
(test #?"@{a}" "1 2 3")
|
139
|
+
(let ((*list-delimiter* ""))
|
140
|
+
(test #?"@{a}" "123")))
|
141
|
+
|
142
|
+
(let* ((a "foo")
|
143
|
+
(b #\Space)
|
144
|
+
(c "bar")
|
145
|
+
(d (list a b c))
|
146
|
+
(x 40))
|
147
|
+
(test #?"$ @" "$ @")
|
148
|
+
(test #?"$(a)" "foo")
|
149
|
+
(test #?"$<a>$[b]" "foo ")
|
150
|
+
(test #?"\U${a}\E \u${a}" "FOO Foo")
|
151
|
+
(test (let ((cl-interpol:*list-delimiter* #\*))
|
152
|
+
#?"@{d}")
|
153
|
+
"foo* *bar")
|
154
|
+
(test (let ((cl-interpol:*list-delimiter* ""))
|
155
|
+
#?"@{d}")
|
156
|
+
"foo bar")
|
157
|
+
(test #?"The result is ${(let ((y 2)) (+ x y))}"
|
158
|
+
"The result is 42")
|
159
|
+
(test #?"${#?'${a} ${c}'} ${x}" "foo bar 40"))
|
160
|
+
|
161
|
+
(setq cl-interpol:*optional-delimiters-p* t)
|
162
|
+
(test (let ((% 23)) #?"$%a%b%") "23a%b%")
|
163
|
+
(test (let ((%a 23)) #?"$%a%b%") "23%b%")
|
164
|
+
(test (let ((%a% 23)) #?"$%a%b%") "23b%")
|
165
|
+
(test (let ((%a%b 23)) #?"$%a%b%") "23%")
|
166
|
+
(test (let ((%a%b% 23)) #?"$%a%b%") "23")
|
167
|
+
(setq cl-interpol:*optional-delimiters-p* nil)
|
168
|
+
|
169
|
+
(load (merge-pathnames "test2.lisp"
|
170
|
+
*cl-interpol-base-directory*))
|
171
|
+
|
172
|
+
(disable-interpol-syntax)
|
173
|
+
|
174
|
+
(cond ((zerop *failure-counter*)
|
175
|
+
(format t "~&All tests passed."))
|
176
|
+
(t
|
177
|
+
(format t "~&~A tests failed!" *failure-counter*)))
|