-
Notifications
You must be signed in to change notification settings - Fork 5
/
library.dylan
248 lines (217 loc) · 4.91 KB
/
library.dylan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
Module: dylan-user
Synopsis: TestWorks - a test harness library for dylan
Author: Andrew Armstrong, James Kirsch
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
All rights reserved.
License: See License.txt in this distribution for details.
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
define library testworks
use command-line-parser;
use common-dylan,
import: { common-dylan, simple-random, threads };
use json;
use io,
import: { format, print, standard-io, streams };
use coloring-stream;
use strings;
use system,
import: { date, file-system, locators, operating-system };
use memory-manager;
export
testworks,
%testworks;
end library testworks;
// Public API
define module testworks
// Top level and test runners
create
run-test-application,
run-tests,
*runner*,
<test-runner>,
runner-debug,
runner-options,
runner-output-stream,
runner-progress,
runner-debug,
runner-skip,
runner-tags;
// Checks (deprecated, use assert-* or expect-*)
create
check,
check-condition,
check-no-condition,
check-equal,
check-false,
check-no-errors,
check-instance?,
check-true;
// Assertions
create
assert-equal,
assert-not-equal,
assert-condition,
assert-signals, // Deprecated; use assert-condition.
assert-no-errors,
assert-instance?,
assert-not-instance?,
assert-true,
assert-false,
expect,
expect-equal,
expect-not-equal,
expect-true,
expect-false,
expect-instance?,
expect-not-instance?,
expect-condition,
expect-no-condition;
create
// Implement this to give detail to expect-equal failures for your own types.
check-equal-failure-detail;
// Components
create
suite-definer,
test-definer,
benchmark-definer;
// Benchmarks
create
benchmark-repeat;
// Output
create
test-output,
test-temp-directory,
write-test-file;
// Options
create
test-option;
// Specs
create
interface-specification-suite-definer,
interface-specification-classes,
interface-specification-class-instantiable?,
make-test-instance,
destroy-test-instance;
end module testworks;
// Internals, for use by test suite.
define module %testworks
use coloring-stream,
rename: { $reset-attributes => $reset-text-attributes };
use command-line-parser;
use common-dylan, exclude: { format-to-string };
use date,
import: { current-date => date/now,
format-date => date/format };
use file-system,
prefix: "fs/";
use format;
use json,
import: { print-json, do-print-json };
use locators;
use operating-system,
prefix: "os/";
use print, import: { print-object };
use simple-random,
import: { random };
use standard-io;
use streams;
use strings;
use testworks;
use threads,
import: { dynamic-bind };
use memory-manager, import: { collect-garbage };
// Debugging options
export
<debug-option>,
$debug-none,
$debug-crashes,
$debug-all,
debug-failures?,
debug?;
// Formatting
export
plural;
// Components
export
<component>,
$components,
*component*,
register-component,
execute-component?,
component-name,
status-name;
// Tests and benchmarks
export
<runnable>,
<benchmark>,
<test>,
test-function,
test-requires-assertions?,
test-tags;
// Suites
export
<suite>,
make-suite, //--- Needed for macro hygiene problems
suite-setup-function, suite-cleanup-function,
suite-components;
// Result objects
export
<result>,
result-name,
result-type-name,
<result-status>,
result-status,
$passed, $failed, $skipped, $not-implemented, $crashed,
$expected-failure, $unexpected-success,
result-seconds,
result-microseconds,
result-time,
result-bytes,
result-reason,
result-passing?,
<component-result>,
result-subresults,
<metered-result>,
<test-result>,
<benchmark-result>,
<benchmark-iteration-result>,
<suite-result>,
do-results,
decide-suite-status,
<check-result>;
// Report functions
export
print-null-report,
print-summary-report,
print-failures-report,
print-full-report,
print-xml-report,
print-surefire-report;
// Progress
export
$progress-none,
$progress-minimal,
$progress-all,
<progress-option>;
// Command line handling
export
make-runner-from-command-line,
parse-args;
export
$xml-version-header,
*check-recording-function*;
// Tags
export
<tag>,
parse-tags,
tags-match?;
// Specs classes
export <definition-spec>,
<constant-spec>,
<variable-spec>,
<class-spec>,
<function-spec>;
// Specs accessors
export spec-name,
spec-title;
end module %testworks;