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,76 @@
1
+ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Base: 10 -*-
2
+ ;;; $Header: /usr/local/cvsrep/cl-unicode/packages.lisp,v 1.24 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-user)
31
+
32
+ (defpackage :cl-unicode
33
+ (:use :cl)
34
+ (:import-from :cl-ppcre
35
+ :*standard-optimize-settings*
36
+ :with-rebinding)
37
+ (:export :+code-point-limit+
38
+ :*scripts-to-try*
39
+ :*try-abbreviations-p*
40
+ :*try-hex-notation-p*
41
+ :*try-lisp-names-p*
42
+ :*try-unicode1-names-p*
43
+ :age
44
+ :bidi-class
45
+ :bidi-classes
46
+ :bidi-mirroring-glyph
47
+ :binary-properties
48
+ :canonicalize-name
49
+ :character-named
50
+ :code-block
51
+ :code-blocks
52
+ :combining-class
53
+ :disable-alternative-character-syntax
54
+ :enable-alternative-character-syntax
55
+ :general-categories
56
+ :general-category
57
+ :has-binary-property
58
+ :has-property
59
+ :list-all-characters
60
+ :lowercase-mapping
61
+ :numeric-type
62
+ :numeric-value
63
+ :property-name
64
+ :property-symbol
65
+ :property-test
66
+ :recognized-properties
67
+ :script
68
+ :scripts
69
+ :titlecase-mapping
70
+ :unicode-error
71
+ :unicode-name
72
+ :unicode1-name
73
+ :uppercase-mapping))
74
+
75
+ (defpackage :cl-unicode-names
76
+ (:use))
@@ -0,0 +1,135 @@
1
+ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-UNICODE; Base: 10 -*-
2
+ ;;; $Header: /usr/local/cvsrep/cl-unicode/specials.lisp,v 1.16 2008/07/24 14:50:37 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
+ (defconstant +code-point-limit+ #x110000
33
+ "The smallest integer which is not a code point in the Unicode codespace.")
34
+
35
+ (defvar *canonical-names* (make-hash-table :test 'eq :size 500)
36
+ "A hash tables which maps property symbols \(see PROPERTY-SYMBOL) to
37
+ their \"canonical names\", i.e. to strings.")
38
+
39
+ (defvar *names-to-code-points* (make-hash-table :test 'equalp :size 20000)
40
+ "A hash table which \(case-insensitively) maps \"canonicalized\"
41
+ character names to their code points.")
42
+
43
+ (defvar *unicode1-names-to-code-points* (make-hash-table :test 'equalp :size 2000)
44
+ "A hash table which \(case-insensitively) maps \"canonicalized\"
45
+ Unicode 1.0 character names to their code points.")
46
+
47
+ (defvar *code-points-to-names* (make-hash-table :size 20000)
48
+ "A hash table which maps code points to the corresponding character
49
+ names.")
50
+
51
+ (defvar *code-points-to-unicode1-names* (make-hash-table :size 2000)
52
+ "A hash table which maps code points to the corresponding Unicode
53
+ 1.0 character names.")
54
+
55
+ (defvar *case-mappings* (make-hash-table :size 2100)
56
+ "A hash table which maps code points to three-element lists
57
+ containing the lowercase, uppercase, and titlecasse mapping of the
58
+ corresponding character \(unless all of them are NIL).")
59
+
60
+ (defvar *general-categories* nil
61
+ "A list of all property symbols which denote general categories.")
62
+
63
+ (defvar *scripts* nil
64
+ "A list of all property symbols which denote scripts.")
65
+
66
+ (defvar *code-blocks* nil
67
+ "A list of all property symbols which denote blocks.")
68
+
69
+ (defvar *binary-properties* nil
70
+ "A list of all property symbols which denote binary properties.")
71
+
72
+ (defvar *bidi-classes* nil
73
+ "A list of all property symbols which denote Bidi classes.")
74
+
75
+ (defvar *property-map* (make-hash-table :test 'equalp :size 1000)
76
+ "A hash table which \(case-insensitively) maps \"canonicalized\"
77
+ property names \(including aliases) to the corresponding property
78
+ symbols.")
79
+
80
+ (defvar *property-tests* (make-hash-table :test 'eq :size 360)
81
+ "A hash table which maps property symbols to a test function which
82
+ tests for the corresponding property.")
83
+
84
+ (defvar *jamo-short-names* (make-hash-table :size 70)
85
+ "A hash table which maps code points to their Jamo short names.
86
+ Needed to compute Hangul syllable names - see COMPUTE-HANGUL-NAME.")
87
+
88
+ (defvar *hangul-syllables-to-code-points* (make-hash-table :test 'equalp :size 12000)
89
+ "A hash table which \(case-insensitively) maps Hangul syllable name
90
+ parts to their code points.")
91
+
92
+ (defvar *try-unicode1-names-p* t
93
+ "This is the default value for the :TRY-UNICODE1-NAMES-P keyword
94
+ argument to CHARACTER-NAMED.")
95
+
96
+ (defvar *try-abbreviations-p* nil
97
+ "This is the default value for the :TRY-ABBREVIATIONS-P keyword
98
+ argument to CHARACTER-NAMED.")
99
+
100
+ (defvar *scripts-to-try* nil
101
+ "This is the default value for the :SCRIPTS-TO-TRY keyword argument
102
+ to CHARACTER-NAMED.")
103
+
104
+ (defvar *try-hex-notation-p* nil
105
+ "This is the default value for the :TRY-HEX-NOTATION-P keyword
106
+ argument to CHARACTER-NAMED.")
107
+
108
+ (defvar *try-lisp-names-p* nil
109
+ "This is the default value for the :TRY-LISP-NAMES-P keyword
110
+ argument to CHARACTER-NAMED.")
111
+
112
+ (defvar *previous-readtables* nil
113
+ "A stack which holds the previous readtables that have been pushed
114
+ here by ENABLE-ALTERNATIVE-CHARACTER-SYNTAX.")
115
+
116
+ (pushnew :cl-unicode *features*)
117
+
118
+ ;; stuff for Nikodemus Siivola's HYPERDOC
119
+ ;; see <http://common-lisp.net/project/hyperdoc/>
120
+ ;; and <http://www.cliki.net/hyperdoc>
121
+ ;; also used by LW-ADD-ONS
122
+
123
+ (defvar *hyperdoc-base-uri* "http://weitz.de/cl-unicode/")
124
+
125
+ (let ((exported-symbols-alist
126
+ (loop for symbol being the external-symbols of :cl-unicode
127
+ collect (cons symbol
128
+ (concatenate 'string
129
+ "#"
130
+ (string-downcase symbol))))))
131
+ (defun hyperdoc-lookup (symbol type)
132
+ (declare (ignore type))
133
+ (cdr (assoc symbol
134
+ exported-symbols-alist
135
+ :test #'eq))))
@@ -0,0 +1,34 @@
1
+ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
2
+ ;;; $Header: /usr/local/cvsrep/cl-unicode/test/packages.lisp,v 1.2 2008/07/20 12:21:22 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-unicode-test
33
+ (:use :cl :cl-unicode)
34
+ (:export :run-all-tests))
@@ -0,0 +1,150 @@
1
+ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-UNICODE-TEST; Base: 10 -*-
2
+ ;;; $Header: /usr/local/cvsrep/cl-unicode/test/tests.lisp,v 1.17 2008/07/23 11:25:07 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-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
+ verbose)
74
+ "Loops through all the forms in the file FILE-NAME and executes each
75
+ of them using EVAL. Reads all forms with the alternative character
76
+ syntax enabled. It is assumed that each FORM specifies a test which
77
+ returns a true value iff it succeeds. Prints each test form to
78
+ *STANDARD-OUTPUT* if VERBOSE is true and shows a simple progress
79
+ indicator otherwise. Returns a true value iff all tests succeeded."
80
+ (enable-alternative-character-syntax)
81
+ (unwind-protect
82
+ (with-open-file (stream file-name)
83
+ (let ((*package* (find-package :cl-unicode-test))
84
+ (*try-unicode1-names-p* t)
85
+ (*try-abbreviations-p* t)
86
+ (*scripts-to-try* '("Hebrew"))
87
+ (*try-hex-notation-p* t)
88
+ (*try-lisp-names-p* t))
89
+ (do-tests ((format nil "Simple tests from file ~S" (file-namestring file-name))
90
+ (not verbose))
91
+ (let ((form (or (read stream nil) (done))))
92
+ (when verbose
93
+ (format t "~&~S" form))
94
+ (cond ((eval form) nil)
95
+ (t (list (format nil "~S returned NIL" form))))))))
96
+ (disable-alternative-character-syntax)))
97
+
98
+ (defun property-tests (&key (file-name
99
+ (make-pathname :name "properties"
100
+ :type nil :version nil
101
+ :defaults *this-file*))
102
+ verbose)
103
+ "Loops through all the forms in the file FILE-NAME and executes each
104
+ of them as a test for a property. The forms must be lists \(C S B)
105
+ where C is a code point \(an integer), S is a string denoting the
106
+ property, and B is boolean denoting whether the character has the
107
+ property or not. Tests are performed using HAS-PROPERTY. Prints each
108
+ test to *STANDARD-OUTPUT* if VERBOSE is true and shows a simple
109
+ progress indicator otherwise. Returns a true value iff all tests
110
+ succeeded."
111
+ (with-open-file (stream file-name)
112
+ (do-tests ((format nil "Properties from file ~S" (file-namestring file-name))
113
+ (not verbose))
114
+ (let ((input-line (or (read stream nil) (done))))
115
+ (destructuring-bind (char-code property-name expected-result)
116
+ input-line
117
+ (when verbose
118
+ (format t "~&~A: #x~X" property-name char-code))
119
+ (let* ((char (and (< char-code char-code-limit) (code-char char-code)))
120
+ (result-1 (has-property char-code property-name))
121
+ (result-2 (and char (has-property char property-name)))
122
+ errors)
123
+ (unless (eq expected-result (not (not result-1)))
124
+ (push (format nil "code point #x~X should ~:[not ~;~]have property \"~A\""
125
+ char-code expected-result property-name)
126
+ errors))
127
+ (when char
128
+ (unless (eq expected-result (not (not result-2)))
129
+ (push (format nil "\(code-char #x~X) should ~:[not ~;~]have property \"~A\""
130
+ char-code expected-result property-name)
131
+ errors)))
132
+ errors))))))
133
+
134
+ (defun run-all-tests (&key verbose)
135
+ "Runs all tests for CL-UNICODE and returns a true value iff all
136
+ tests succeeded. VERBOSE is interpreted by the individual test suites
137
+ above."
138
+ (let ((successp t))
139
+ (macrolet ((run-test-suite (&body body)
140
+ `(unless (progn ,@body)
141
+ (setq successp nil))))
142
+ ;; run the automatically generated tests for derived properties
143
+ (run-test-suite (property-tests :verbose verbose
144
+ :file-name (make-pathname :name "derived-properties"
145
+ :type nil :version nil
146
+ :defaults *this-file*)))
147
+ (run-test-suite (property-tests :verbose verbose))
148
+ (run-test-suite (simple-tests :verbose verbose)))
149
+ (format t "~2&~:[Some tests failed~;All tests passed~]." successp)
150
+ successp))
@@ -0,0 +1,94 @@
1
+ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-UNICODE; Base: 10 -*-
2
+ ;;; $Header: /usr/local/cvsrep/cl-unicode/test-functions.lisp,v 1.6 2008/07/21 20:04: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-unicode)
31
+
32
+ (defun install-one-test (property-symbol test-function)
33
+ (setf (gethash property-symbol *property-tests*)
34
+ test-function
35
+ (gethash (canonicalize-name (property-name property-symbol)) *property-map*)
36
+ property-symbol))
37
+
38
+ (defun install-script-tests ()
39
+ (dolist (script *scripts*)
40
+ (install-one-test script
41
+ (let ((script script))
42
+ (lambda (c)
43
+ (eq (nth-value 1 (script c)) script))))))
44
+
45
+ (defun install-code-block-tests ()
46
+ (dolist (code-block *code-blocks*)
47
+ (install-one-test (register-property-symbol
48
+ (format nil "Block:~A" (property-name code-block)))
49
+ (let ((code-block code-block))
50
+ (lambda (c)
51
+ (eq (nth-value 1 (code-block c)) code-block))))))
52
+
53
+ (defun install-general-category-tests ()
54
+ (dolist (general-category *general-categories*)
55
+ (install-one-test general-category
56
+ (let ((general-category general-category))
57
+ (lambda (c)
58
+ (eq (nth-value 1 (general-category c)) general-category))))))
59
+
60
+ (defun install-binary-properties-tests ()
61
+ (dolist (binary-property *binary-properties*)
62
+ (install-one-test binary-property
63
+ (let ((binary-property binary-property))
64
+ (lambda (c)
65
+ (has-binary-property c binary-property))))))
66
+
67
+ (defun install-bidi-class-tests ()
68
+ (dolist (bidi-class *bidi-classes*)
69
+ (install-one-test (register-property-symbol
70
+ (format nil "BidiClass:~A" (property-name bidi-class)))
71
+ (let ((bidi-class bidi-class))
72
+ (lambda (c)
73
+ (eq (nth-value 1 (bidi-class c)) bidi-class))))))
74
+
75
+ (defun install-miscellaneous-tests ()
76
+ (install-one-test (register-property-symbol "ASCII")
77
+ (lambda (c)
78
+ (<= 0 (ensure-code-point c) 127)))
79
+ (install-one-test (register-property-symbol "Assigned")
80
+ (lambda (c)
81
+ (not (eq (nth-value 1 (general-category c))
82
+ '#.(property-symbol "Cn")))))
83
+ (install-one-test (register-property-symbol "GraphemeLink")
84
+ (lambda (c)
85
+ ;; Canonical_Combining_Class=Virama
86
+ (eql (combining-class c) 9))))
87
+
88
+ (defun install-tests ()
89
+ (install-script-tests)
90
+ (install-code-block-tests)
91
+ (install-general-category-tests)
92
+ (install-binary-properties-tests)
93
+ (install-bidi-class-tests)
94
+ (install-miscellaneous-tests))