clucumber 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,274 @@
1
+ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-UNICODE; Base: 10 -*-
2
+ ;;; $Header: /usr/local/cvsrep/cl-unicode/util.lisp,v 1.29 2008/07/24 14:46:20 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-unicode)
31
+
32
+ (defun parse-hex (string)
33
+ "Parses STRING as a hexadecimal number."
34
+ (parse-integer string :radix 16))
35
+
36
+ (defun canonicalize-name (name)
37
+ "Converts the string NAME into a \"canonicalized\" name which can be
38
+ used for unambiguous look-ups by removing all whitespace, hyphens, and
39
+ underline characters.
40
+
41
+ Tries not to remove hyphens preceded by spaces if this could lead to
42
+ ambiguities as described in
43
+ <http://unicode.org/unicode/reports/tr18/#Name_Properties>.
44
+
45
+ All CL-UNICODE functions which accept string \"names\" for characters
46
+ or properties will canonicalize the name first using this function and
47
+ will then look up the name case-insensitively."
48
+ (values (ppcre:regex-replace-all "[ _](-A|O-E)$|[-_\\s]" name
49
+ (lambda (match register)
50
+ (declare (ignore match))
51
+ (cond (register (format nil " ~A" register))
52
+ (t "")))
53
+ :simple-calls t)))
54
+
55
+ (defun property-symbol (name)
56
+ "Returns a symbol in the CL-UNICODE-NAMES packages \(which is only
57
+ used for this purpose) which can stand in for the string NAME in
58
+ look-ups. The symbol's name is the result of \"canonicalizing\" and
59
+ then upcasing NAME.
60
+
61
+ A symbol returned by this function is only really useful and only
62
+ actually a property symbol if the second return value is true.
63
+
64
+ All exported functions of CL-UNICODE which return strings which are
65
+ property names return the corresponding property symbol as their
66
+ second return value. All exported functions of CL-UNICODE which
67
+ accept property names as arguments will also accept property symbols.
68
+
69
+ See also PROPERTY-NAME."
70
+ (let ((symbol (intern (string-upcase (canonicalize-name name)) :cl-unicode-names)))
71
+ (values symbol (property-name symbol))))
72
+
73
+ (defun register-property-symbol (name)
74
+ "Converts NAME to a property symbol using PROPERTY-SYMBOL and
75
+ \"registers\" it in the *CANONICAL-NAMES* hash table."
76
+ (let ((symbol (property-symbol name)))
77
+ (setf (gethash symbol *canonical-names*) name)
78
+ symbol))
79
+
80
+ (defun property-name (symbol)
81
+ "Returns a name \(not \"the\" name) for a property symbol SYMBOL if
82
+ it is known to CL-UNICODE. Note that
83
+
84
+ \(STRING= \(PROPERTY-NAME \(PROPERTY-SYMBOL <string>)) <string>)
85
+
86
+ is not necessarily true even if the property name is not NIL while
87
+
88
+ \(EQ \(PROPERTY-SYMBOL \(PROPERTY-NAME <symbol>)) <symbol>)
89
+
90
+ always holds if there is a property name for <symbol>.
91
+
92
+ See also PROPERTY-SYMBOL."
93
+ (values (gethash symbol *canonical-names*)))
94
+
95
+ (defun tree-lookup (code-point tree)
96
+ "Looks up an attribute for CODE-POINT in the binary search tree
97
+ TREE. TREE is a tree as created by BUILD-TREE."
98
+ (labels ((try (node)
99
+ (and node
100
+ (destructuring-bind (((from . to) . value) left-branch right-branch)
101
+ node
102
+ (cond ((< code-point from) (try left-branch))
103
+ ((> code-point to) (try right-branch))
104
+ (t value))))))
105
+ (try tree)))
106
+
107
+ (defun try-abbreviations (name scripts-to-try)
108
+ "Helper function called by CHARACTER-NAMED when the
109
+ :TRY-ABBREVIATIONS-P keyword argument is true. Tries to interpret
110
+ NAME as an abbreviation for a longer Unicode name and returns the
111
+ corresponding code point if it succeeds."
112
+ (flet ((size-word (string)
113
+ (if (ppcre:scan "[A-Z]" string) "CAPITAL" "SMALL"))
114
+ (try (script size-word short-name)
115
+ (or (character-named (format nil "~A ~A letter ~A"
116
+ script size-word short-name)
117
+ :want-code-point-p t)
118
+ (character-named (format nil "~A letter ~A"
119
+ script short-name)
120
+ :want-code-point-p t)
121
+ (character-named (format nil "~A ~A"
122
+ script short-name)
123
+ :want-code-point-p t))))
124
+ (ppcre:register-groups-bind (script short-name)
125
+ ("^([^:]+):([^:]+)$" name)
126
+ (let ((size-word (size-word short-name)))
127
+ (return-from try-abbreviations
128
+ (try script size-word short-name))))
129
+ (loop with size-word = (size-word name)
130
+ for script in scripts-to-try
131
+ thereis (try script size-word name))))
132
+
133
+ (defgeneric mapping (c position want-code-point-p)
134
+ (:documentation "Returns the simple case mapping for the character C
135
+ \(a code point or a Lisp character) in position POSITION where 0 means
136
+ lowercase, 1 uppercase, and 2 titlecase. Returns a character if
137
+ WANT-CODE-POINT-P is NIL and a code point otherwise.")
138
+ (:method ((char character) position want-code-point-p)
139
+ (mapping (char-code char) position want-code-point-p))
140
+ (:method ((code-point integer) position want-code-point-p)
141
+ (let* ((mappings (gethash code-point *case-mappings*))
142
+ (code-point (or (nth position mappings) code-point)))
143
+ (if want-code-point-p
144
+ code-point
145
+ (and code-point (code-char code-point))))))
146
+
147
+ (defun cjk-unified-ideograph-p (code-point)
148
+ "Returns a true value if CODE-POINT is the code point of a CJK
149
+ unified ideograph for which we can algorithmically derive the name."
150
+ (or (<= #x3400 code-point #x4db5)
151
+ (<= #x4e00 code-point #x9fc3)
152
+ (<= #x20000 code-point #x2a6d6)))
153
+
154
+ (defun maybe-compute-cjk-name (code-point)
155
+ "Computes the name for CODE-POINT if CODE-POINT denotes a CJK
156
+ unified ideograph the name of which can be algorithmically derived."
157
+ (when (cjk-unified-ideograph-p code-point)
158
+ (format nil "CJK UNIFIED IDEOGRAPH-~X" code-point)))
159
+
160
+ (defun maybe-find-cjk-code-point (name)
161
+ "Computes the code point for NAME if NAME is the name of a CJK
162
+ unified ideograph the name of which can be algorithmically derived."
163
+ (ppcre:register-groups-bind ((#'parse-hex code-point))
164
+ ;; canonicalized
165
+ ("(?i)^CJKUNIFIEDIDEOGRAPH([0-9A-F]{4,5}|10[0-9A-F]{4})$" name)
166
+ (when (cjk-unified-ideograph-p code-point)
167
+ code-point)))
168
+
169
+ (defmacro define-hangul-constant (name value)
170
+ (flet ((create-symbol (name)
171
+ (intern (format nil "+~:@(~C-~A~)+" (char name 0) (subseq name 1)) :cl-unicode)))
172
+ `(eval-when (:compile-toplevel :load-toplevel :execute)
173
+ (defconstant ,(create-symbol name) ,value
174
+ ,(format nil "The constant `~A' from chapter 3 of the Unicode book." name)))))
175
+
176
+ (define-hangul-constant "SBase" #xac00)
177
+ (define-hangul-constant "LBase" #x1100)
178
+ (define-hangul-constant "VBase" #x1161)
179
+ (define-hangul-constant "TBase" #x11a7)
180
+ (define-hangul-constant "VCount" 21)
181
+ (define-hangul-constant "TCount" 28)
182
+ (define-hangul-constant "NCount" (* +v-count+ +t-count+))
183
+
184
+ (declaim (inline compute-hangul-name))
185
+ (defun compute-hangul-name (code-point)
186
+ "Algorithmically derives the Hangul syllable name \(the part behind
187
+ \"HANGUL SYLLABLE \") of the character with code point CODE-POINT as
188
+ described in section 3.12 of the Unicode book."
189
+ (declare #.*standard-optimize-settings*)
190
+ (declare (fixnum code-point))
191
+ (let* ((s-index (- code-point +s-base+))
192
+ (l-value (+ +l-base+ (floor s-index +n-count+)))
193
+ (v-value (+ +v-base+ (floor (mod s-index +n-count+) +t-count+)))
194
+ (t-value (+ +t-base+ (mod s-index +t-count+))))
195
+ (declare (fixnum s-index t-value))
196
+ (format nil "~A~A~@[~A~]"
197
+ (gethash l-value *jamo-short-names*)
198
+ (gethash v-value *jamo-short-names*)
199
+ (and (/= t-value +t-base+)
200
+ (gethash t-value *jamo-short-names*)))))
201
+
202
+ (defconstant +first-hangul-syllable+ #xac00
203
+ "The code point of the first Hangul syllable the name of which can
204
+ be algorithmically derived.")
205
+ (defconstant +last-hangul-syllable+ #xd7a3
206
+ "The code point of the last Hangul syllable the name of which can be
207
+ algorithmically derived.")
208
+
209
+ (defun add-hangul-names ()
210
+ "Computes the names for all Hangul syllables and registers them in
211
+ the *HANGUL-SYLLABLES-TO-CODE-POINTS* hash table. Used for
212
+ CHARACTER-NAMED."
213
+ (declare #.*standard-optimize-settings*)
214
+ (format t "~&;;; Computing Hangul syllable names")
215
+ (loop for code-point from +first-hangul-syllable+ to +last-hangul-syllable+
216
+ for name = (compute-hangul-name code-point)
217
+ do (setf (gethash name *hangul-syllables-to-code-points*) code-point)))
218
+
219
+ (defun hangul-syllable-p (code-point)
220
+ "Returns a true value if CODE-POINT is the code point of a Hangul
221
+ syllable for which we can algorithmically derive the name."
222
+ (<= +first-hangul-syllable+ code-point +last-hangul-syllable+))
223
+
224
+ (defun maybe-compute-hangul-syllable-name (code-point)
225
+ "Computes the name for CODE-POINT if CODE-POINT denotes a Hangul
226
+ syllable the name of which can be algorithmically derived."
227
+ (when (hangul-syllable-p code-point)
228
+ (format nil "HANGUL SYLLABLE ~X" (compute-hangul-name code-point))))
229
+
230
+ (defun maybe-find-hangul-syllable-code-point (name)
231
+ "Computes the code point for NAME if NAME is the name of a Hangul
232
+ syllable the name of which can be algorithmically derived."
233
+ (ppcre:register-groups-bind (name)
234
+ ;; canonicalized
235
+ ("(?i)^HANGULSYLLABLE([A-Z]*)$" name)
236
+ (gethash name *hangul-syllables-to-code-points*)))
237
+
238
+ (defmacro ensure-code-point (c)
239
+ "Helper macro so that C can be treated like a code point even if it
240
+ is a Lisp character."
241
+ (with-rebinding (c)
242
+ `(etypecase ,c
243
+ (integer ,c)
244
+ (character (char-code ,c)))))
245
+
246
+ (defun unicode-name-reader (stream char arg)
247
+ "The reader function used when the alternative character syntax is
248
+ enabled."
249
+ (declare (ignore char arg))
250
+ (let ((name (with-output-to-string (out)
251
+ (write-char (read-char stream t nil t) out)
252
+ (loop for next-char = (read-char stream t nil t)
253
+ while (find next-char "abcdefghijklmnopqrstuvwxyz0123456789_-+:"
254
+ :test 'char-equal)
255
+ do (write-char next-char out)
256
+ finally (unread-char next-char stream)))))
257
+ (or (character-named name)
258
+ (error 'character-not-found :name name))))
259
+
260
+ (defun %enable-alternative-character-syntax ()
261
+ "Internal function used to enable alternative character syntax and
262
+ store current readtable on stack."
263
+ (push *readtable* *previous-readtables*)
264
+ (setq *readtable* (copy-readtable))
265
+ (set-dispatch-macro-character #\# #\\ #'unicode-name-reader)
266
+ (values))
267
+
268
+ (defun %disable-alternative-character-syntax ()
269
+ "Internal function used to restore previous readtable."
270
+ (setq *readtable*
271
+ (if *previous-readtables*
272
+ (pop *previous-readtables*)
273
+ (copy-readtable nil)))
274
+ (values))
@@ -0,0 +1,14 @@
1
+ (defpackage "KMRCL-TESTS-5AM"
2
+ (:use "COMMON-LISP" "KMRCL" "5AM"))
3
+ (in-package #:kmrcl-tests-5am)
4
+
5
+ (def-suite test-strings :description "Test some KMRCL string tests.")
6
+ (in-suite test-strings)
7
+ (test :str.0
8
+ (is (substitute-chars-strings "" nil) ""))
9
+ (test :str.1
10
+ (is (substitute-chars-strings "abcd" nil) "abcd"))
11
+ (test :str.2
12
+ (is (substitute-chars-strings "abcd" nil) "abcde"))
13
+
14
+ (run! 'test-strings)
@@ -0,0 +1,13 @@
1
+ (defpackage "KMRCL-TESTS-LIFT"
2
+ (:use "COMMON-LISP" "KMRCL" "LIFT"))
3
+ (in-package #:kmrcl-tests-lift)
4
+
5
+ (deftestsuite test-strings () ())
6
+ (addtest :str.0
7
+ (ensure-same (substitute-chars-strings "" nil) ""))
8
+ (addtest :str.1
9
+ (ensure-same (substitute-chars-strings "abcd" nil) "abcd"))
10
+ (addtest :str.2
11
+ (ensure-same (substitute-chars-strings "abcd" nil) "abcde"))
12
+
13
+ (run-tests)
@@ -0,0 +1,16 @@
1
+ #|
2
+ can you change the equality test?
3
+ |#
4
+
5
+ (in-package #:cl)
6
+ (defpackage #:kmrcl-tests-rt
7
+ (:use #:kmrcl #:cl #:rtest))
8
+ (in-package #:kmrcl-tests-rt)
9
+
10
+ (rem-all-tests)
11
+
12
+ (deftest :str.0 (substitute-chars-strings "" nil) "")
13
+ (deftest :str.1 (substitute-chars-strings "abcd" nil) "abcd")
14
+ (deftest :str.2 (substitute-chars-strings "abcd" nil) "abcde")
15
+
16
+ (do-tests)
@@ -0,0 +1,15 @@
1
+ (in-package #:cl)
2
+ (defpackage #:kmrcl-tests-xlunit
3
+ (:use #:kmrcl #:cl #:xlunit))
4
+ (in-package #:kmrcl-tests-xlunit)
5
+
6
+ (defclass string-test-case (test-case)
7
+ ())
8
+ (def-test-method :str.0 ((test string-test-case) :run nil)
9
+ (assert-true (string-equal (substitute-chars-strings "" nil) "")))
10
+ (def-test-method :str.1 ((test string-test-case) :run nil)
11
+ (assert-true (string-equal (substitute-chars-strings "abcd" nil) "abcd")))
12
+ (def-test-method :str.1 ((test string-test-case) :run nil)
13
+ (assert-true (string-equal (substitute-chars-strings "abcd" nil) "abcde")))
14
+
15
+ (textui-test-run (get-suite string-test-case))
@@ -0,0 +1,61 @@
1
+ #|
2
+ ok - in run-test, we should catch errors / failures in test-setup and test-teardown too
3
+ ok~ - better warning and errors and restarts
4
+ ok - make interaction an option (and don't print stuff if compiling or loading)
5
+ ok - add *features* check to not make tests (NO-LIFT-TESTS)
6
+ ok - add counts to list-tests
7
+ ok~ - When working interactively, bad tests get inserted and then it's hard to
8
+ fix things. Maybe compile immediately and check for warnings / errors
9
+ with handler-case. A remove-test command (but when is it invoked)?
10
+ not - allow addtest to add multiple tests or add addtests
11
+ ok - downcase create test message (per Westy)
12
+ ok - need with-test or something like it
13
+ ok - need list-tests (both names and classes)
14
+ ok - remove initforms, this lets us pretend that we're in something like a let*
15
+ ok I'd like run-tests to not require any arguments
16
+ ok - allow for :setup ... and (:setup ...)
17
+ ok - addtest can specify a test-suite / class
18
+ ok - allow (:documentation for each test), but where to put it
19
+ ok get rid of abstract-test
20
+ ok - interactive-test-switch: when you add or define, run the tests right then
21
+ ok - add code to optionally test all subclasses of a test class
22
+ deferred - better error message when there is no test name
23
+ ok - don't require superclasses or slots (if only one, assume it's slots unless
24
+ one of the putative slots is already a test-mixin subclass)
25
+ ok - put initforms of test class into the setup automatically (even if no
26
+ other setup is defined. (maybe a :before)
27
+ ok - currently, each addtest will add a new test-case with the same test but a
28
+ different name, we need to save the text and compare. It would be somewhat
29
+ gross, but we could sxhash the contents of the test for a mostly good fix.
30
+ ok - don't allow two tests for the same class to have the same name
31
+ ok - addtest should redefine existing tests--maybe with a warning
32
+ ok - allow automatic naming but save code too so that it's easy to see
33
+ what went wrong
34
+ ok - need to empty hash-tables in deftest before parsing the tests
35
+ ok - test-names must be keywords? Why is that again? Can we check and
36
+ warn for errors
37
+ ok - allow for export-p option
38
+ ok - cannot do (addtest (ensure-warning (let ((x 0)) (print (/ 4 x)))))
39
+ ok - how about (remove-test [(class)] name)
40
+ ok - tests that a form generates an error or a warning
41
+ ok - add :test parameter to ensure-same (and redo to get better messages)
42
+ ok - addtest should handle verbose? too and print the full details of the
43
+ single problem, if any
44
+ ~ - Add interactivity to make-sure-slots-are-not-superclasses
45
+ ok - If there are superclasses, add all of their slots to the slot list too
46
+ ok - should redefining the superclass remove all methods of its subclasses?
47
+ (probably, could have slot dependencies)
48
+ ok - need runtest
49
+ ok - refactor print-test-report
50
+ obsolete - handle errors and use restarts in make-sure-slots-are-not-superclasses
51
+ ok? - deftest's defclass repeats initargs and accessors
52
+ ok - deftest's defclass has slots in wrong order
53
+ ok - undeftest ==> remove-test
54
+ ok - use *test-output* as stream
55
+ ok - use dynamic scope for *TEST-IS-BEING-DEFINED?* rather than unwind-protect
56
+ obsolete - add :evaluate option to ensure-same
57
+ obsolete - maybe ensure= instead of ensure-same
58
+ ok - refactor ensure, etc.
59
+ ok - get rid of #FEATURE-CASE
60
+
61
+ |#