difects 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +21 -0
- data/LICENSE +15 -0
- data/bin/difects +25 -0
- data/lib/difects/auto.rb +17 -0
- data/lib/difects/inochi.rb +93 -0
- data/lib/difects/long.rb +25 -0
- data/lib/difects/mini.rb +92 -0
- data/lib/difects/spec.rb +31 -0
- data/lib/difects/unit.rb +101 -0
- data/lib/difects.rb +1169 -0
- data/man/man1/difects.1.gz +0 -0
- data/man.html +1191 -0
- metadata +94 -0
data/man.html
ADDED
@@ -0,0 +1,1191 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>difects(1) - Assertion testing library for Ruby</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:5px 1ex;background:#edeceb;border-left:1ex solid #ddd}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
<style type='text/css' media='all'>
|
45
|
+
/* style: toc */
|
46
|
+
.man-navigation {display:block !important;position:fixed;top:0;left:113ex;height:100%;width:100%;padding:36px 0 0 0;border-left:1px solid #dbdbdb;background:#eee}
|
47
|
+
.man-navigation a,.man-navigation a:hover,.man-navigation a:link,.man-navigation a:visited {display:block;margin:0;padding:5px 2px 5px 20px;color:#999;text-decoration:none}
|
48
|
+
.man-navigation a:hover {color:#111;text-decoration:underline}
|
49
|
+
</style>
|
50
|
+
<style type='text/css' media='all'>
|
51
|
+
/* style: 80c */
|
52
|
+
.mp {max-width:78ex}
|
53
|
+
|
54
|
+
.man-navigation {left:91ex}
|
55
|
+
</style>
|
56
|
+
</head>
|
57
|
+
<!--
|
58
|
+
The following styles are deprecated and will be removed at some point:
|
59
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
60
|
+
|
61
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
62
|
+
.man-navigation should be used instead.
|
63
|
+
-->
|
64
|
+
<body id='manpage'>
|
65
|
+
<div class='mp' id='man'>
|
66
|
+
|
67
|
+
<div class='man-navigation' style='display:none'>
|
68
|
+
<a href="#NAME">NAME</a>
|
69
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
70
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
71
|
+
<a href="#OPTIONS">OPTIONS</a>
|
72
|
+
<a href="#TESTS">TESTS</a>
|
73
|
+
<a href="#ASSERTIONS">ASSERTIONS</a>
|
74
|
+
<a href="#EMULATION">EMULATION</a>
|
75
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
76
|
+
<a href="#HACKING">HACKING</a>
|
77
|
+
<a href="#VERSIONS">VERSIONS</a>
|
78
|
+
<a href="#AUTHORS">AUTHORS</a>
|
79
|
+
<a href="#CREDITS">CREDITS</a>
|
80
|
+
<a href="#LICENSE">LICENSE</a>
|
81
|
+
<a href="#SEE-ALSO">SEE ALSO</a>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<ol class='man-decor man-head man head'>
|
85
|
+
<li class='tl'>difects(1)</li>
|
86
|
+
<li class='tc'>Version 3.0.0</li>
|
87
|
+
<li class='tr'>difects(1)</li>
|
88
|
+
</ol>
|
89
|
+
|
90
|
+
<h2 id="NAME">NAME</h2>
|
91
|
+
<p class="man-name">
|
92
|
+
<code>difects</code> - <span class="man-whatis">Assertion testing library for Ruby</span>
|
93
|
+
</p>
|
94
|
+
|
95
|
+
<p>DIFECTS is an assertion testing library for <a href="http://ruby-lang.org">Ruby</a> that emphasizes a simple
|
96
|
+
assertion vocabulary, instant debuggability of failures, and flexibility in
|
97
|
+
composing tests.</p>
|
98
|
+
|
99
|
+
<h3 id="Features">Features</h3>
|
100
|
+
|
101
|
+
<ul>
|
102
|
+
<li><p>Adds only 7 mnemonic method names to your memory:</p>
|
103
|
+
|
104
|
+
<p><code>D</code>escribe, <code>I</code>nform, <code>F</code>alse, <code>E</code>rror, <code>C</code>atch, <code>T</code>rue, and <code>S</code>hare.</p></li>
|
105
|
+
<li><p>Lets you debug assertion failures interactively.</p></li>
|
106
|
+
<li><p>Lets you nest tests, assertions, and execution hooks.</p></li>
|
107
|
+
<li><p>Maintains a detailed report of assertion failures.</p></li>
|
108
|
+
<li><p>Implemented in 420 lines of pure Ruby.</p></li>
|
109
|
+
</ul>
|
110
|
+
|
111
|
+
|
112
|
+
<h3 id="Resources">Resources</h3>
|
113
|
+
|
114
|
+
<dl>
|
115
|
+
<dt>Issue tracker (report bugs, request features, get help)</dt><dd><p><a href="http://github.com/sunaku/difects/issues" data-bare-link="true">http://github.com/sunaku/difects/issues</a></p></dd>
|
116
|
+
<dt>Source code (browse online or obtain with <a href="http://git-scm.com">Git</a>)</dt><dd><p><a href="http://github.com/sunaku/difects" data-bare-link="true">http://github.com/sunaku/difects</a></p></dd>
|
117
|
+
<dt>API documentation</dt><dd><p><a href="http://snk.tuxfamily.org/lib/difects/api/" data-bare-link="true">http://snk.tuxfamily.org/lib/difects/api/</a></p></dd>
|
118
|
+
<dt>Announcements feed</dt><dd><p><a href="http://snk.tuxfamily.org/lib/difects/ann.xml" data-bare-link="true">http://snk.tuxfamily.org/lib/difects/ann.xml</a></p></dd>
|
119
|
+
<dt>Official website</dt><dd><p><a href="http://snk.tuxfamily.org/lib/difects/" data-bare-link="true">http://snk.tuxfamily.org/lib/difects/</a></p></dd>
|
120
|
+
</dl>
|
121
|
+
|
122
|
+
|
123
|
+
<h3 id="Setup">Setup</h3>
|
124
|
+
|
125
|
+
<p>Prerequisites:</p>
|
126
|
+
|
127
|
+
<ul>
|
128
|
+
<li><p><a href="http://ruby-lang.org">Ruby</a> 1.8.6 or newer.</p></li>
|
129
|
+
<li><p><a href="http://rubygems.org">RubyGems</a> 1.3.6 or newer.</p></li>
|
130
|
+
</ul>
|
131
|
+
|
132
|
+
|
133
|
+
<p>Installing:</p>
|
134
|
+
|
135
|
+
<pre><code>gem install difects
|
136
|
+
</code></pre>
|
137
|
+
|
138
|
+
<p>Upgrading:</p>
|
139
|
+
|
140
|
+
<pre><code>gem update difects
|
141
|
+
</code></pre>
|
142
|
+
|
143
|
+
<p>Removing:</p>
|
144
|
+
|
145
|
+
<pre><code>gem uninstall difects
|
146
|
+
</code></pre>
|
147
|
+
|
148
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
149
|
+
|
150
|
+
<p><code>difects</code> [<var>OPTIONS</var>] (<var>FILE</var>|<var>GLOB</var>) ...</p>
|
151
|
+
|
152
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
153
|
+
|
154
|
+
<p>Evaluates the given <var>FILE</var>s and also files matching the given <var>GLOB</var> patterns.</p>
|
155
|
+
|
156
|
+
<p>The exit status of this command reflects the number of errors and assertion
|
157
|
+
failures up to a maximum of 255 (to avoid 8-bit unsigned integer overflow).</p>
|
158
|
+
|
159
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
160
|
+
|
161
|
+
<dl>
|
162
|
+
<dt><code>-d</code>, <code>--debug</code></dt><dd><p>Launch interactive debugger upon assertion failures.</p></dd>
|
163
|
+
<dt><code>-h</code>, <code>--help</code></dt><dd><p>Display this manual and exit.</p></dd>
|
164
|
+
<dt><code>-v</code>, <code>--version</code></dt><dd><p>Print version number and exit.</p></dd>
|
165
|
+
</dl>
|
166
|
+
|
167
|
+
|
168
|
+
<h2 id="TESTS">TESTS</h2>
|
169
|
+
|
170
|
+
<p>The <code>D()</code> method creates a new <strong>test</strong>, which is analagous to the <code>describe</code>
|
171
|
+
keyword in <a href="http://rspec.info">RSpec</a> and the concept of a "test case" in <a href="http://en.wikipedia.org/wiki/XUnit">xUnit</a>. A test may
|
172
|
+
contain nested tests (see <strong>Insulation</strong> below).</p>
|
173
|
+
|
174
|
+
<pre><code>D "outer test" do
|
175
|
+
# assertions and logic here
|
176
|
+
|
177
|
+
D "inner test" do
|
178
|
+
# more assertions and logic here
|
179
|
+
end
|
180
|
+
end
|
181
|
+
</code></pre>
|
182
|
+
|
183
|
+
<h3 id="Hooks">Hooks</h3>
|
184
|
+
|
185
|
+
<p>A <strong>hook</strong> is a scheduled point of entry into the test execution process. The
|
186
|
+
<code>D()</code> method provides several of them:</p>
|
187
|
+
|
188
|
+
<pre><code>D "outer test" do
|
189
|
+
D .< { puts "before each nested test" }
|
190
|
+
D .> { puts "after each nested test" }
|
191
|
+
D .<< { puts "before all nested tests" }
|
192
|
+
D .>> { puts "after all nested tests" }
|
193
|
+
|
194
|
+
D "inner test" do
|
195
|
+
# assertions and logic here
|
196
|
+
end
|
197
|
+
end
|
198
|
+
</code></pre>
|
199
|
+
|
200
|
+
<p>A hook method can be called multiple times. Every call to a hook method
|
201
|
+
schedules additional logic to be executed during the hook:</p>
|
202
|
+
|
203
|
+
<pre><code>D .< { puts "do something" }
|
204
|
+
D .< { puts "do something more!" }
|
205
|
+
</code></pre>
|
206
|
+
|
207
|
+
<h3 id="Insulation">Insulation</h3>
|
208
|
+
|
209
|
+
<p>The <code>D!()</code> method defines a new test that is explicitly insulated from
|
210
|
+
the tests that contain it and also from the top-level Ruby environment.
|
211
|
+
Root-level calls to the <code>D()</code> method are insulated by default.</p>
|
212
|
+
|
213
|
+
<p>Inside an insulated test, you are free to mix-in (using the <code>extend</code> keyword,
|
214
|
+
not the <code>include</code> keyword) any modules your test logic needs and also define
|
215
|
+
your own constants, methods, and classes.</p>
|
216
|
+
|
217
|
+
<h3 id="Sharing">Sharing</h3>
|
218
|
+
|
219
|
+
<dl>
|
220
|
+
<dt class="flush"><code>S()</code></dt><dd><p>Mechanism for sharing code. When called with a block, it shares the given
|
221
|
+
block (under a given identifier) for injection into other tests. When
|
222
|
+
called without a block, it injects a previously shared block (under a given
|
223
|
+
identifier) into the environment where it is called.</p></dd>
|
224
|
+
<dt class="flush"><code>S!()</code></dt><dd><p>Combination of the two uses of the <code>S()</code> method: it lets you simultaneously
|
225
|
+
share a block of code while injecting it into the environment where that
|
226
|
+
method is called.</p></dd>
|
227
|
+
<dt class="flush"><code>S?()</code></dt><dd><p>Checks whether any code has been shared under a given identifier.</p></dd>
|
228
|
+
</dl>
|
229
|
+
|
230
|
+
|
231
|
+
<h3 id="Information">Information</h3>
|
232
|
+
|
233
|
+
<dl>
|
234
|
+
<dt class="flush"><code>I()</code></dt><dd><p>Mechanism for inserting arbitrary Ruby objects into the test execution
|
235
|
+
report. You can think of this method as a way to <em>inform</em> yourself.</p></dd>
|
236
|
+
<dt class="flush"><code>I!()</code></dt><dd><p>Starts the interactive debugger at the location where it is called.</p></dd>
|
237
|
+
</dl>
|
238
|
+
|
239
|
+
|
240
|
+
<h3 id="Execution">Execution</h3>
|
241
|
+
|
242
|
+
<p>Tests are executed in depth-first search (DFS) order.</p>
|
243
|
+
|
244
|
+
<p>You can configure the test execution process using:</p>
|
245
|
+
|
246
|
+
<pre><code>DIFECTS.debug = your_choice_here
|
247
|
+
DIFECTS.quiet = your_choice_here
|
248
|
+
</code></pre>
|
249
|
+
|
250
|
+
<p>You can execute all tests defined thus far using:</p>
|
251
|
+
|
252
|
+
<pre><code>DIFECTS.start
|
253
|
+
</code></pre>
|
254
|
+
|
255
|
+
<p>You can stop the execution at any time using:</p>
|
256
|
+
|
257
|
+
<pre><code>DIFECTS.stop
|
258
|
+
</code></pre>
|
259
|
+
|
260
|
+
<p>You can view the results of execution using:</p>
|
261
|
+
|
262
|
+
<pre><code>puts DIFECTS.trace.to_yaml
|
263
|
+
puts DIFECTS.stats.to_yaml
|
264
|
+
</code></pre>
|
265
|
+
|
266
|
+
<p>You can mix-in the <code>DIFECTS</code> module into your program and execute all tests
|
267
|
+
defined by your program before it terminates by simply adding the following
|
268
|
+
line at the top of your program:</p>
|
269
|
+
|
270
|
+
<pre><code>require 'difects/auto'
|
271
|
+
</code></pre>
|
272
|
+
|
273
|
+
<p>See the API documentation for more information and examples.</p>
|
274
|
+
|
275
|
+
<h2 id="ASSERTIONS">ASSERTIONS</h2>
|
276
|
+
|
277
|
+
<p>The following methods accept a block parameter and assert something about the
|
278
|
+
result of executing that block. They also accept an optional message, which
|
279
|
+
is shown in failure reports (see <strong>Failures</strong> below) if they fail.</p>
|
280
|
+
|
281
|
+
<dl>
|
282
|
+
<dt class="flush"><code>T()</code></dt><dd><p>assert true (not <code>nil</code> and not <code>false</code>)</p></dd>
|
283
|
+
<dt class="flush"><code>F()</code></dt><dd><p>assert not true (<code>nil</code> or <code>false</code>)</p></dd>
|
284
|
+
<dt class="flush"><code>E()</code></dt><dd><p>assert that an execption is raised</p></dd>
|
285
|
+
<dt class="flush"><code>C()</code></dt><dd><p>assert that a symbol is thrown</p></dd>
|
286
|
+
</dl>
|
287
|
+
|
288
|
+
|
289
|
+
<p>For the <code>T()</code> and <code>F()</code> methods, you may also pass the condition to be
|
290
|
+
asserted as the first argument (instead of passing it as a block). This might
|
291
|
+
result in a less noisy more pleasing syntax, depending on your taste:</p>
|
292
|
+
|
293
|
+
<pre><code>D "Lottery" do
|
294
|
+
winning_ticket = rand()
|
295
|
+
|
296
|
+
D "My chances of winning" do
|
297
|
+
my_ticket = rand()
|
298
|
+
|
299
|
+
# passing the condition as a block:
|
300
|
+
F("I won?! Dream on.") { my_ticket == winning_ticket }
|
301
|
+
|
302
|
+
# passing the condition as an argument:
|
303
|
+
F my_ticket == winning_ticket, "I won?! Dream on."
|
304
|
+
|
305
|
+
end
|
306
|
+
end
|
307
|
+
</code></pre>
|
308
|
+
|
309
|
+
<h3 id="Negation">Negation</h3>
|
310
|
+
|
311
|
+
<p>The following methods are the <em>opposite</em> of normal assertions.</p>
|
312
|
+
|
313
|
+
<dl>
|
314
|
+
<dt class="flush"><code>T!()</code></dt><dd><p>same as <code>F()</code></p></dd>
|
315
|
+
<dt class="flush"><code>F!()</code></dt><dd><p>same as <code>T()</code></p></dd>
|
316
|
+
<dt class="flush"><code>E!()</code></dt><dd><p>assert that an exception is <em>not</em> raised</p></dd>
|
317
|
+
<dt class="flush"><code>C!()</code></dt><dd><p>assert that a symbol is <em>not</em> thrown</p></dd>
|
318
|
+
</dl>
|
319
|
+
|
320
|
+
|
321
|
+
<h3 id="Sampling">Sampling</h3>
|
322
|
+
|
323
|
+
<p>The following methods let you <em>check the outcome</em> of an assertion without
|
324
|
+
recording a success or failure in the test execution report.</p>
|
325
|
+
|
326
|
+
<dl>
|
327
|
+
<dt class="flush"><code>T?()</code></dt><dd><p>returns true if <code>T()</code> passes; false otherwise</p></dd>
|
328
|
+
<dt class="flush"><code>F?()</code></dt><dd><p>returns true if <code>F()</code> passes; false otherwise</p></dd>
|
329
|
+
<dt class="flush"><code>E?()</code></dt><dd><p>returns true if <code>E()</code> passes; false otherwise</p></dd>
|
330
|
+
<dt class="flush"><code>C?()</code></dt><dd><p>returns true if <code>C()</code> passes; false otherwise</p></dd>
|
331
|
+
</dl>
|
332
|
+
|
333
|
+
|
334
|
+
<h3 id="Failures">Failures</h3>
|
335
|
+
|
336
|
+
<p>Assertions failures are reported in the following manner:</p>
|
337
|
+
|
338
|
+
<pre><code>- fail: block must yield true (!nil && !false)
|
339
|
+
call:
|
340
|
+
- test/simple.rb:17
|
341
|
+
- test/simple.rb:3
|
342
|
+
code: |-
|
343
|
+
[12..22] in test/simple.rb
|
344
|
+
12
|
345
|
+
13 D "with more nested tests" do
|
346
|
+
14 x = 5
|
347
|
+
15
|
348
|
+
16 T { x > 2 } # passes
|
349
|
+
=> 17 F { x > 2 } # fails
|
350
|
+
18 E { x.hello } # passes
|
351
|
+
19 end
|
352
|
+
20 end
|
353
|
+
21
|
354
|
+
22 # equivalent of before(:each) or setup()
|
355
|
+
bind: test/simple.rb:17
|
356
|
+
vars:
|
357
|
+
x: (Fixnum) 5
|
358
|
+
y: (Fixnum) 83
|
359
|
+
</code></pre>
|
360
|
+
|
361
|
+
<p>Failure reports are composed of the following sections:</p>
|
362
|
+
|
363
|
+
<dl>
|
364
|
+
<dt class="flush">fail</dt><dd><p>Description of the assertion failure.</p></dd>
|
365
|
+
<dt class="flush">call</dt><dd><p>Stack trace leading to the point of failure.</p></dd>
|
366
|
+
<dt class="flush">code</dt><dd><p>Source code surrounding the point of failure.</p></dd>
|
367
|
+
<dt class="flush">bind</dt><dd><p>Location where local variables (in the "vars" section) were extracted.</p></dd>
|
368
|
+
<dt class="flush">vars</dt><dd><p>Local variables visible at the point of failure.</p></dd>
|
369
|
+
</dl>
|
370
|
+
|
371
|
+
|
372
|
+
<p>After the failure is reported, you will be placed into a debugger to
|
373
|
+
investigate the failure if the <code>DIFECTS.debug</code> option is enabled.</p>
|
374
|
+
|
375
|
+
<p>Assertion failure reports can be accessed at any time within the test
|
376
|
+
execution trace provided by the <code>DIFECTS.trace()</code> method.</p>
|
377
|
+
|
378
|
+
<h2 id="EMULATION">EMULATION</h2>
|
379
|
+
|
380
|
+
<p>DIFECTS can emulate several popular testing libraries:</p>
|
381
|
+
|
382
|
+
<dl>
|
383
|
+
<dt>difects/spec</dt><dd><p><a href="http://rspec.info">RSpec</a> emulation layer</p></dd>
|
384
|
+
<dt>difects/unit</dt><dd><p><a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a> emulation layer</p></dd>
|
385
|
+
<dt>difects/mini</dt><dd><p><a href="http://blog.zenspider.com/minitest/">Minitest</a> emulation layer</p></dd>
|
386
|
+
<dt>difects/long</dt><dd><p>Readability emulation layer</p></dd>
|
387
|
+
</dl>
|
388
|
+
|
389
|
+
|
390
|
+
<p>Simply require one of these emulation layers into your test suite and you can
|
391
|
+
write your tests using the familiar syntax of the testing library it emulates.</p>
|
392
|
+
|
393
|
+
<h3 id="difects-spec">difects/spec</h3>
|
394
|
+
|
395
|
+
<p>This library emulates <a href="http://rspec.info">RSpec</a> by adding the following methods to the
|
396
|
+
<code>DIFECTS</code> module.</p>
|
397
|
+
|
398
|
+
<dl>
|
399
|
+
<dt><code>after</code>(<em>what</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/spec.rb#L21">lib/difects/spec.rb:21</a></p></dd>
|
400
|
+
<dt><code>before</code>(<em>what</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/spec.rb#L10">lib/difects/spec.rb:10</a></p></dd>
|
401
|
+
<dt><code>context</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
402
|
+
<dt><code>describe</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
403
|
+
<dt><code>it</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
404
|
+
</dl>
|
405
|
+
|
406
|
+
|
407
|
+
<h3 id="difects-unit">difects/unit</h3>
|
408
|
+
|
409
|
+
<p>This library emulates <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a> by adding the following methods to the
|
410
|
+
<code>DIFECTS</code> module.</p>
|
411
|
+
|
412
|
+
<dl>
|
413
|
+
<dt><code>assert</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
414
|
+
<dt><code>assert_empty</code>(<em>collection</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L26">lib/difects/unit.rb:26</a></p></dd>
|
415
|
+
<dt><code>assert_equal</code>(<em>expected</em>, <em>actual</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L31">lib/difects/unit.rb:31</a></p></dd>
|
416
|
+
<dt><code>assert_in_delta</code>(<em>expected</em>, <em>actual</em>, <em>delta</em>=nil, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L36">lib/difects/unit.rb:36</a></p></dd>
|
417
|
+
<dt><code>assert_in_epsilon</code>(<em>expected</em>, <em>actual</em>, <em>delta</em>=nil, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L36">lib/difects/unit.rb:36</a></p></dd>
|
418
|
+
<dt><code>assert_include</code>(<em>item</em>, <em>collection</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L47">lib/difects/unit.rb:47</a></p></dd>
|
419
|
+
<dt><code>assert_instance_of</code>(<em>klass</em>, <em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L52">lib/difects/unit.rb:52</a></p></dd>
|
420
|
+
<dt><code>assert_kind_of</code>(<em>klass</em>, <em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L57">lib/difects/unit.rb:57</a></p></dd>
|
421
|
+
<dt><code>assert_match</code>(<em>pattern</em>, <em>string</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L67">lib/difects/unit.rb:67</a></p></dd>
|
422
|
+
<dt><code>assert_nil</code>(<em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L62">lib/difects/unit.rb:62</a></p></dd>
|
423
|
+
<dt><code>assert_not</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
424
|
+
<dt><code>assert_not_empty</code>(<em>collection</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L26">lib/difects/unit.rb:26</a></p></dd>
|
425
|
+
<dt><code>assert_not_equal</code>(<em>expected</em>, <em>actual</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L31">lib/difects/unit.rb:31</a></p></dd>
|
426
|
+
<dt><code>assert_not_in_delta</code>(<em>expected</em>, <em>actual</em>, <em>delta</em>=nil, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L36">lib/difects/unit.rb:36</a></p></dd>
|
427
|
+
<dt><code>assert_not_in_epsilon</code>(<em>expected</em>, <em>actual</em>, <em>delta</em>=nil, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L36">lib/difects/unit.rb:36</a></p></dd>
|
428
|
+
<dt><code>assert_not_include</code>(<em>item</em>, <em>collection</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L47">lib/difects/unit.rb:47</a></p></dd>
|
429
|
+
<dt><code>assert_not_instance_of</code>(<em>klass</em>, <em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L52">lib/difects/unit.rb:52</a></p></dd>
|
430
|
+
<dt><code>assert_not_kind_of</code>(<em>klass</em>, <em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L57">lib/difects/unit.rb:57</a></p></dd>
|
431
|
+
<dt><code>assert_not_match</code>(<em>pattern</em>, <em>string</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L67">lib/difects/unit.rb:67</a></p></dd>
|
432
|
+
<dt><code>assert_not_nil</code>(<em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L62">lib/difects/unit.rb:62</a></p></dd>
|
433
|
+
<dt><code>assert_not_operator</code>(<em>object</em>, <em>operator</em>, <em>operand</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L77">lib/difects/unit.rb:77</a></p></dd>
|
434
|
+
<dt><code>assert_not_raise</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L82">lib/difects/unit.rb:82</a></p></dd>
|
435
|
+
<dt><code>assert_not_respond_to</code>(<em>object</em>, <em>query</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L86">lib/difects/unit.rb:86</a></p></dd>
|
436
|
+
<dt><code>assert_not_same</code>(<em>expected</em>, <em>actual</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L72">lib/difects/unit.rb:72</a></p></dd>
|
437
|
+
<dt><code>assert_not_send</code>(<em>object</em>, <em>query</em>, *<em>args</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L95">lib/difects/unit.rb:95</a></p></dd>
|
438
|
+
<dt><code>assert_not_throw</code>(<em>symbol</em>, <em>message</em>=nil, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L91">lib/difects/unit.rb:91</a></p></dd>
|
439
|
+
<dt><code>assert_operator</code>(<em>object</em>, <em>operator</em>, <em>operand</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L77">lib/difects/unit.rb:77</a></p></dd>
|
440
|
+
<dt><code>assert_raise</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L82">lib/difects/unit.rb:82</a></p></dd>
|
441
|
+
<dt><code>assert_respond_to</code>(<em>object</em>, <em>query</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L86">lib/difects/unit.rb:86</a></p></dd>
|
442
|
+
<dt><code>assert_same</code>(<em>expected</em>, <em>actual</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L72">lib/difects/unit.rb:72</a></p></dd>
|
443
|
+
<dt><code>assert_send</code>(<em>object</em>, <em>query</em>, *<em>args</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L95">lib/difects/unit.rb:95</a></p></dd>
|
444
|
+
<dt><code>assert_throw</code>(<em>symbol</em>, <em>message</em>=nil, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L91">lib/difects/unit.rb:91</a></p></dd>
|
445
|
+
<dt><code>setup</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
446
|
+
<dt><code>setup!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
447
|
+
<dt><code>teardown</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
448
|
+
<dt><code>teardown!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
449
|
+
<dt><code>test</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
450
|
+
</dl>
|
451
|
+
|
452
|
+
|
453
|
+
<h3 id="difects-mini">difects/mini</h3>
|
454
|
+
|
455
|
+
<p>This library emulates <a href="http://blog.zenspider.com/minitest/">Minitest</a> by adding the following methods to the
|
456
|
+
<code>DIFECTS</code> module.</p>
|
457
|
+
|
458
|
+
<dl>
|
459
|
+
<dt><code>refute</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
460
|
+
<dt><code>refute_empty</code>(<em>collection</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L26">lib/difects/unit.rb:26</a></p></dd>
|
461
|
+
<dt><code>refute_equal</code>(<em>expected</em>, <em>actual</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L31">lib/difects/unit.rb:31</a></p></dd>
|
462
|
+
<dt><code>refute_in_delta</code>(<em>expected</em>, <em>actual</em>, <em>delta</em>=nil, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L36">lib/difects/unit.rb:36</a></p></dd>
|
463
|
+
<dt><code>refute_in_epsilon</code>(<em>expected</em>, <em>actual</em>, <em>delta</em>=nil, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L36">lib/difects/unit.rb:36</a></p></dd>
|
464
|
+
<dt><code>refute_include</code>(<em>item</em>, <em>collection</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L47">lib/difects/unit.rb:47</a></p></dd>
|
465
|
+
<dt><code>refute_instance_of</code>(<em>klass</em>, <em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L52">lib/difects/unit.rb:52</a></p></dd>
|
466
|
+
<dt><code>refute_kind_of</code>(<em>klass</em>, <em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L57">lib/difects/unit.rb:57</a></p></dd>
|
467
|
+
<dt><code>refute_match</code>(<em>pattern</em>, <em>string</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L67">lib/difects/unit.rb:67</a></p></dd>
|
468
|
+
<dt><code>refute_nil</code>(<em>object</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L62">lib/difects/unit.rb:62</a></p></dd>
|
469
|
+
<dt><code>refute_operator</code>(<em>object</em>, <em>operator</em>, <em>operand</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L77">lib/difects/unit.rb:77</a></p></dd>
|
470
|
+
<dt><code>refute_raise</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L82">lib/difects/unit.rb:82</a></p></dd>
|
471
|
+
<dt><code>refute_respond_to</code>(<em>object</em>, <em>query</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L86">lib/difects/unit.rb:86</a></p></dd>
|
472
|
+
<dt><code>refute_same</code>(<em>expected</em>, <em>actual</em>, <em>message</em>=nil)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L72">lib/difects/unit.rb:72</a></p></dd>
|
473
|
+
<dt><code>refute_send</code>(<em>object</em>, <em>query</em>, *<em>args</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L95">lib/difects/unit.rb:95</a></p></dd>
|
474
|
+
<dt><code>refute_throw</code>(<em>symbol</em>, <em>message</em>=nil, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects/unit.rb#L91">lib/difects/unit.rb:91</a></p></dd>
|
475
|
+
</dl>
|
476
|
+
|
477
|
+
|
478
|
+
<h3 id="difects-long">difects/long</h3>
|
479
|
+
|
480
|
+
<p>This library emulates Readability by adding the following methods to the
|
481
|
+
<code>DIFECTS</code> module.</p>
|
482
|
+
|
483
|
+
<dl>
|
484
|
+
<dt><code>Catch</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
485
|
+
<dt><code>Catch!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
486
|
+
<dt><code>Catch?</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
487
|
+
<dt><code>Describe</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
488
|
+
<dt><code>Describe!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
489
|
+
<dt><code>Error</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
490
|
+
<dt><code>Error!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
491
|
+
<dt><code>Error?</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
492
|
+
<dt><code>False</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
493
|
+
<dt><code>False!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
494
|
+
<dt><code>False?</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
495
|
+
<dt><code>Inform</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
496
|
+
<dt><code>Inform!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
497
|
+
<dt><code>Share</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
498
|
+
<dt><code>Share!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
499
|
+
<dt><code>Share?</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
500
|
+
<dt><code>True</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
501
|
+
<dt><code>True!</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
502
|
+
<dt><code>True?</code>(*<em>args</em>, &<em>block</em>)</dt><dd><p>Defined at <a href="http://github.com/sunaku/difects/tree/master/lib/difects.rb#L1126">lib/difects.rb:1126</a></p></dd>
|
503
|
+
</dl>
|
504
|
+
|
505
|
+
|
506
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
507
|
+
|
508
|
+
<p>Begin by loading DIFECTS into your program:</p>
|
509
|
+
|
510
|
+
<pre><code>require 'rubygems' # might not be necessary; see HACKING
|
511
|
+
require 'difects'
|
512
|
+
</code></pre>
|
513
|
+
|
514
|
+
<p>You now have access to the <code>DIFECTS</code> module, whose methods can be called
|
515
|
+
directly:</p>
|
516
|
+
|
517
|
+
<pre><code>DIFECTS.D "hello" do # D() is a class method
|
518
|
+
puts "world"
|
519
|
+
end
|
520
|
+
</code></pre>
|
521
|
+
|
522
|
+
<p>or mixed-in and called implicitly:</p>
|
523
|
+
|
524
|
+
<pre><code>include DIFECTS # mix-in the DIFECTS module
|
525
|
+
|
526
|
+
D "hello" do # D() is an instance method
|
527
|
+
puts "world"
|
528
|
+
end
|
529
|
+
</code></pre>
|
530
|
+
|
531
|
+
<p>according to your preference.</p>
|
532
|
+
|
533
|
+
<h3 id="Logging-information-in-the-execution-report">Logging information in the execution report</h3>
|
534
|
+
|
535
|
+
<p>When the following test is run:</p>
|
536
|
+
|
537
|
+
<pre><code>require 'difects/auto'
|
538
|
+
|
539
|
+
D 'Wizard' do
|
540
|
+
I 'Preparing spell to defeat mortal foes...'
|
541
|
+
end
|
542
|
+
|
543
|
+
D 'Magician' do
|
544
|
+
I 'Preparing rabbits to pull from hat...', rand(15)
|
545
|
+
end
|
546
|
+
|
547
|
+
D 'Calculator' do
|
548
|
+
I Math::PI, [1, 2, 3, ['a', 'b', 'c']], {:foo => 'bar!'}
|
549
|
+
end
|
550
|
+
</code></pre>
|
551
|
+
|
552
|
+
<p>DIFECTS will output the following:</p>
|
553
|
+
|
554
|
+
<pre><code>---
|
555
|
+
- Wizard:
|
556
|
+
- Preparing spell to defeat mortal foes...
|
557
|
+
- Magician:
|
558
|
+
- Preparing rabbits to pull from hat...
|
559
|
+
- 14
|
560
|
+
- Calculator:
|
561
|
+
- 3.141592653589793
|
562
|
+
- - 1
|
563
|
+
- 2
|
564
|
+
- 3
|
565
|
+
- - a
|
566
|
+
- b
|
567
|
+
- c
|
568
|
+
- foo: bar!
|
569
|
+
---
|
570
|
+
time: 0.002947349
|
571
|
+
</code></pre>
|
572
|
+
|
573
|
+
<h3 id="Sharing-code-between-tests">Sharing code between tests</h3>
|
574
|
+
|
575
|
+
<p>When the following test is run:</p>
|
576
|
+
|
577
|
+
<pre><code>require 'difects/auto'
|
578
|
+
|
579
|
+
S :knowledge do
|
580
|
+
I 'Knowledge is power!'
|
581
|
+
end
|
582
|
+
|
583
|
+
D 'Healer' do
|
584
|
+
S :knowledge
|
585
|
+
end
|
586
|
+
|
587
|
+
D 'Warrior' do
|
588
|
+
S! :strength do
|
589
|
+
I 'Strength is power!'
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
D 'Wizard' do
|
594
|
+
S :knowledge
|
595
|
+
S :strength
|
596
|
+
end
|
597
|
+
|
598
|
+
D 'King' do
|
599
|
+
T { S? :knowledge }
|
600
|
+
T { S? :strength }
|
601
|
+
F { S? :power }
|
602
|
+
I 'Power is power!'
|
603
|
+
end
|
604
|
+
</code></pre>
|
605
|
+
|
606
|
+
<p>DIFECTS will output the following:</p>
|
607
|
+
|
608
|
+
<pre><code>---
|
609
|
+
- Healer:
|
610
|
+
- Knowledge is power!
|
611
|
+
- Warrior:
|
612
|
+
- Strength is power!
|
613
|
+
- Wizard:
|
614
|
+
- Knowledge is power!
|
615
|
+
- Strength is power!
|
616
|
+
- King:
|
617
|
+
- Power is power!
|
618
|
+
---
|
619
|
+
pass: 3
|
620
|
+
time: 0.007106484
|
621
|
+
</code></pre>
|
622
|
+
|
623
|
+
<h3 id="Insulated-and-uninsulated-tests">Insulated and uninsulated tests</h3>
|
624
|
+
|
625
|
+
<p>When the following test is run:</p>
|
626
|
+
|
627
|
+
<pre><code>require 'difects/auto'
|
628
|
+
|
629
|
+
D "a root-level test" do
|
630
|
+
@outside = 1
|
631
|
+
T { defined? @outside }
|
632
|
+
T { @outside == 1 }
|
633
|
+
|
634
|
+
D "an inner, non-insulated test" do
|
635
|
+
T { defined? @outside }
|
636
|
+
T { @outside == 1 }
|
637
|
+
end
|
638
|
+
|
639
|
+
D! "an inner, insulated test" do
|
640
|
+
F { defined? @outside }
|
641
|
+
F { @outside == 1 }
|
642
|
+
|
643
|
+
@inside = 2
|
644
|
+
T { defined? @inside }
|
645
|
+
T { @inside == 2 }
|
646
|
+
end
|
647
|
+
|
648
|
+
F { defined? @inside }
|
649
|
+
F { @inside == 2 }
|
650
|
+
end
|
651
|
+
</code></pre>
|
652
|
+
|
653
|
+
<p>DIFECTS will output the following:</p>
|
654
|
+
|
655
|
+
<pre><code>---
|
656
|
+
- a root-level test:
|
657
|
+
- an inner, non-insulated test:
|
658
|
+
- an inner, insulated test:
|
659
|
+
---
|
660
|
+
pass: 10
|
661
|
+
time: 0.007744531
|
662
|
+
</code></pre>
|
663
|
+
|
664
|
+
<h2 id="HACKING">HACKING</h2>
|
665
|
+
|
666
|
+
<p>This section is meant for people who want to develop DIFECTS's source code.</p>
|
667
|
+
|
668
|
+
<h3 id="Prerequisites">Prerequisites</h3>
|
669
|
+
|
670
|
+
<p>Install Ruby libraries necessary for development:</p>
|
671
|
+
|
672
|
+
<pre><code>gem install difects --development
|
673
|
+
</code></pre>
|
674
|
+
|
675
|
+
<h3 id="Infrastructure">Infrastructure</h3>
|
676
|
+
|
677
|
+
<p><a href="http://snk.tuxfamily.org/lib/inochi/">Inochi</a> serves as the project infrastructure for DIFECTS. It handles tasks
|
678
|
+
such as building this help manual and API documentation, and packaging,
|
679
|
+
announcing, and publishing new releases. See its help manual and list of
|
680
|
+
tasks to get started:</p>
|
681
|
+
|
682
|
+
<pre><code>inochi --help # display help manual
|
683
|
+
inochi --tasks # list available tasks
|
684
|
+
</code></pre>
|
685
|
+
|
686
|
+
<h3 id="-LOAD_PATH-setup">$LOAD_PATH setup</h3>
|
687
|
+
|
688
|
+
<p>Ensure that the <code>lib/</code> directory is listed in Ruby's <code>$LOAD_PATH</code> before you
|
689
|
+
use any libraries therein or run any executables in the <code>bin/</code> directory.</p>
|
690
|
+
|
691
|
+
<p>This can be achieved by passing an option to Ruby:</p>
|
692
|
+
|
693
|
+
<pre><code>ruby -Ilib bin/difects
|
694
|
+
irb -Ilib -r difects
|
695
|
+
</code></pre>
|
696
|
+
|
697
|
+
<p>Or by setting the <code>$RUBYLIB</code> environment variable:</p>
|
698
|
+
|
699
|
+
<pre><code>export RUBYLIB=lib # bash, ksh, zsh
|
700
|
+
setenv RUBYLIB lib # csh
|
701
|
+
set -x RUBYLIB lib # fish
|
702
|
+
|
703
|
+
ruby bin/difects
|
704
|
+
irb -r difects
|
705
|
+
</code></pre>
|
706
|
+
|
707
|
+
<p>Or by installing the <a href="http://github.com/chneukirchen/rup">ruby-wrapper</a> tool.</p>
|
708
|
+
|
709
|
+
<h3 id="RubyGems-setup">RubyGems setup</h3>
|
710
|
+
|
711
|
+
<p>If you use Ruby 1.8 or older, then ensure that RubyGems is activated before
|
712
|
+
you use any libraries in the <code>lib/</code> directory or run any executables in the
|
713
|
+
<code>bin/</code> directory.</p>
|
714
|
+
|
715
|
+
<p>This can be achieved by passing an option to Ruby:</p>
|
716
|
+
|
717
|
+
<pre><code>ruby -rubygems bin/difects
|
718
|
+
irb -rubygems -r difects
|
719
|
+
</code></pre>
|
720
|
+
|
721
|
+
<p>Or by setting the <code>$RUBYOPT</code> environment variable:</p>
|
722
|
+
|
723
|
+
<pre><code>export RUBYOPT=-rubygems # bash, ksh, zsh
|
724
|
+
setenv RUBYOPT -rubygems # csh
|
725
|
+
set -x RUBYOPT -rubygems # fish
|
726
|
+
</code></pre>
|
727
|
+
|
728
|
+
<h3 id="Running-tests">Running tests</h3>
|
729
|
+
|
730
|
+
<p>Simply execute the included test runner, which sets up Ruby's <code>$LOAD_PATH</code> for
|
731
|
+
testing, loads the included <code>test/test_helper.rb</code> file, and then evaluates all
|
732
|
+
<code>test/**/*_test.rb</code> files:</p>
|
733
|
+
|
734
|
+
<pre><code>test/runner
|
735
|
+
</code></pre>
|
736
|
+
|
737
|
+
<p>Its exit status will indicate whether all tests have passed. It may also
|
738
|
+
print additional pass/fail information depending on the testing library used
|
739
|
+
in the <code>test/test_helper.rb</code> file.</p>
|
740
|
+
|
741
|
+
<h3 id="Contributing">Contributing</h3>
|
742
|
+
|
743
|
+
<p>Fork this project on GitHub (see <strong>Resources</strong> above) and send a pull request.</p>
|
744
|
+
|
745
|
+
<h2 id="VERSIONS">VERSIONS</h2>
|
746
|
+
|
747
|
+
<p>This section contains release notes of current and past releases.</p>
|
748
|
+
|
749
|
+
<h3 id="Version-3-0-0-2010-07-24-">Version 3.0.0 (2010-07-24)</h3>
|
750
|
+
|
751
|
+
<p>This release renames the project to "DIFECTS", reduces cruft, improves the
|
752
|
+
presentation and debuggability of assertion failures, and revises the manual.</p>
|
753
|
+
|
754
|
+
<p>Thank you:</p>
|
755
|
+
|
756
|
+
<ul>
|
757
|
+
<li>Gavin Sinclair inspired me to work on this project again!</li>
|
758
|
+
</ul>
|
759
|
+
|
760
|
+
|
761
|
+
<p>Incompatible changes:</p>
|
762
|
+
|
763
|
+
<ul>
|
764
|
+
<li><p>Rename project from "Dfect" to "DIFECTS", which stands for:</p>
|
765
|
+
|
766
|
+
<p><code>D</code>escribe, <code>I</code>nform, <code>F</code>alse, <code>E</code>rror, <code>C</code>atch, <code>T</code>rue, <code>S</code>hare</p></li>
|
767
|
+
<li><p>Remove ruby-debug integration because it is only helpful if you run a
|
768
|
+
program inside it from the very start! That is, you cannot start
|
769
|
+
ruby-debug in the middle of a program and expect it to know about the
|
770
|
+
call stack that lead up to that point in the program. Instead, we now
|
771
|
+
use IRB to inspect program state at the point of failure only.</p></li>
|
772
|
+
<li><p>Remove <code>--quiet</code> option because user can pipe to /dev/null instead.</p></li>
|
773
|
+
<li><p>Rename <code>run()</code> to <code>start()</code> to better complement <code>stop()</code>. The <code>run()</code>
|
774
|
+
method no longer clears test results; use <code>reset()</code> for that.</p></li>
|
775
|
+
<li><p>Rename <code>L()</code> to <code>I()</code> as in "inform" the user.</p></li>
|
776
|
+
<li><p>Replace <code>options()</code> with <code>debug()</code>.</p></li>
|
777
|
+
<li><p>Replace <code>report()</code> with <code>trace()</code> and <code>stats()</code>.</p></li>
|
778
|
+
<li><p>Rename the <code>difects/full</code> library to <code>difects/long</code>.</p></li>
|
779
|
+
<li><p>Do not report instance variables in assertion failures.</p></li>
|
780
|
+
</ul>
|
781
|
+
|
782
|
+
|
783
|
+
<p>New features:</p>
|
784
|
+
|
785
|
+
<ul>
|
786
|
+
<li><p>Improve debuggability by tracking the bindings of all lines of code
|
787
|
+
executed leading up to the point of failure using Ruby's
|
788
|
+
awesome <code>set_trace_func</code> facility.</p>
|
789
|
+
|
790
|
+
<p>This allows block-less assertions to be debugged with the same level of
|
791
|
+
accuracy as normal block-given assertions:</p>
|
792
|
+
|
793
|
+
<pre><code>x = 1
|
794
|
+
y = 3
|
795
|
+
T { x == y } # a block-given assertion
|
796
|
+
T x == y # a block-less assertion
|
797
|
+
</code></pre>
|
798
|
+
|
799
|
+
<p>In both cases, you will be able to inspect the local variables x and y!</p></li>
|
800
|
+
<li><p>Add <code>I!()</code> method to start the interactive debugger anywhere in your tests.</p></li>
|
801
|
+
<li><p>Add <code>reset()</code> to manually clear previous test results.</p></li>
|
802
|
+
<li><p>Alias <code>test()</code> to <code>D()</code> in <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a> emulation layer.</p></li>
|
803
|
+
<li><p>Fallback to <code>pp()</code> if <code>to_yaml()</code> fails while reporting failures.</p></li>
|
804
|
+
<li><p>Use <a href="http://rubygems.org/gems/orderedhash">OrderedHash</a> library in Ruby versions older than 1.9 for
|
805
|
+
consistent presentation of information in assertion failures.</p></li>
|
806
|
+
<li><p>Show full failure details before starting debugger instead of omitting
|
807
|
+
the backtrace and local variables listing.</p></li>
|
808
|
+
<li><p>Use PP to pretty-print variable values in failure details.</p></li>
|
809
|
+
<li><p>Omit unavailable information from failure details.</p></li>
|
810
|
+
<li><p>Put backtrace above code listing and variables in failure details.</p></li>
|
811
|
+
<li><p>Prevent empty array leaf nodes in execution trace.</p></li>
|
812
|
+
</ul>
|
813
|
+
|
814
|
+
|
815
|
+
<p>Bug fixes:</p>
|
816
|
+
|
817
|
+
<ul>
|
818
|
+
<li><p>Make <code>DIFECTS</code> module's instance methods available as class methods.</p></li>
|
819
|
+
<li><p>Always display fail trace before entering debugger.</p></li>
|
820
|
+
<li><p>Always clear test execution internals after <code>start()</code>.</p></li>
|
821
|
+
<li><p>Prevent IRB re-initialization errors when starting debugger.</p></li>
|
822
|
+
</ul>
|
823
|
+
|
824
|
+
|
825
|
+
<p>Housekeeping:</p>
|
826
|
+
|
827
|
+
<ul>
|
828
|
+
<li><p>Clarify how to mix-in modules inside insulated tests in the manual.</p>
|
829
|
+
|
830
|
+
<p>Thanks to Gavin Sinclair for reporting this issue.</p></li>
|
831
|
+
<li><p>Document methods (with hyperlinks to the location in the source code
|
832
|
+
where they are defined) provided by emulation layers in manual.</p></li>
|
833
|
+
<li><p>Talk about passing condition as first argument to <code>T</code> and <code>F</code> assertions
|
834
|
+
and provide a code example in the manual.</p></li>
|
835
|
+
<li><p>Clean up the code and revise the manual. Yay!</p></li>
|
836
|
+
</ul>
|
837
|
+
|
838
|
+
|
839
|
+
<h3 id="Version-2-2-0-2010-04-28-">Version 2.2.0 (2010-04-28)</h3>
|
840
|
+
|
841
|
+
<p>This release adds a UNIX manual page and a sub-library for full method names.</p>
|
842
|
+
|
843
|
+
<p>New features:</p>
|
844
|
+
|
845
|
+
<ul>
|
846
|
+
<li><p>Add <code>dfect/full</code> sub-library that provides full name aliases to Dfect's
|
847
|
+
abbreviated vocabulary:</p>
|
848
|
+
|
849
|
+
<p><code>D</code>escribe, <code>T</code>rue, <code>F</code>alse, <code>E</code>rror, <code>C</code>atch, <code>S</code>hare, and <code>L</code>og.</p></li>
|
850
|
+
<li><p>Run <code>dfect --help</code> to see the UNIX manual page!</p></li>
|
851
|
+
</ul>
|
852
|
+
|
853
|
+
|
854
|
+
<p>Housekeeping:</p>
|
855
|
+
|
856
|
+
<ul>
|
857
|
+
<li>Upgrade to Inochi 3.0.0 and revise the help manual.</li>
|
858
|
+
</ul>
|
859
|
+
|
860
|
+
|
861
|
+
<h3 id="Version-2-1-0-2010-03-31-">Version 2.1.0 (2010-03-31)</h3>
|
862
|
+
|
863
|
+
<p>This release adds a command-line test runner and performs some minor
|
864
|
+
housekeeping.</p>
|
865
|
+
|
866
|
+
<p>New features:</p>
|
867
|
+
|
868
|
+
<ul>
|
869
|
+
<li>Add <code>bin/dfect</code> executable as command-line interface to this library.</li>
|
870
|
+
</ul>
|
871
|
+
|
872
|
+
|
873
|
+
<p>Housekeeping:</p>
|
874
|
+
|
875
|
+
<ul>
|
876
|
+
<li><p>Do not <code>require 'rubygems'</code> before loading the "ruby-debug" library.</p></li>
|
877
|
+
<li><p>Upgrade to Inochi 2.0.0-rc2 for managing this project.</p></li>
|
878
|
+
</ul>
|
879
|
+
|
880
|
+
|
881
|
+
<h3 id="Version-2-0-0-2010-03-21-">Version 2.0.0 (2010-03-21)</h3>
|
882
|
+
|
883
|
+
<p>This release adds the ability to insulate tests from each other, share code
|
884
|
+
between them, makes the order of parameters consistent in the API, improves
|
885
|
+
user interactivity, fixes some bugs, and revises the user manual.</p>
|
886
|
+
|
887
|
+
<p>Incompatible changes:</p>
|
888
|
+
|
889
|
+
<ul>
|
890
|
+
<li><p>Root-level calls to the <code>Dfect::D()</code>
|
891
|
+
method are automatically insulated now.</p></li>
|
892
|
+
<li><p>The <code>Dfect::E()</code> methods now expects its optional message
|
893
|
+
parameter to be the <em>last parameter</em> in the parameter list.</p></li>
|
894
|
+
<li><p>The <code>Dfect::C()</code> methods now expect their first parameter to
|
895
|
+
be a symbol instead of the optional message to be shown in
|
896
|
+
case of assertion failure.</p></li>
|
897
|
+
<li><p>The <code>Dfect::R()</code> has been renamed to <code>Dfect::L()</code>,
|
898
|
+
which is a mnemonic for "Logging".</p></li>
|
899
|
+
<li><p>Shorten names of hash keys in the execution trace for brevity
|
900
|
+
and rename <code>:raise</code> key in report statistics to <code>:error</code>.</p></li>
|
901
|
+
<li><p>Only the most helpful subset of the failure details is shown before
|
902
|
+
placing the user into a debugger because they can query the omitted
|
903
|
+
information (on demand) inside the debugger.</p></li>
|
904
|
+
<li><p>The execution trace is only shown if all tests passed in <code>Dfect::run()</code>.</p></li>
|
905
|
+
<li><p>The <code>:debug</code> option is now set to Ruby's <code>$DEBUG</code> global by default.</p></li>
|
906
|
+
</ul>
|
907
|
+
|
908
|
+
|
909
|
+
<p>New features:</p>
|
910
|
+
|
911
|
+
<ul>
|
912
|
+
<li><p>Print failures as they occur instead of waiting until the end.</p></li>
|
913
|
+
<li><p>Allow passing condition as argument to true/false assertions instead
|
914
|
+
of requiring the condition to be passed as a code block, and also fall
|
915
|
+
back to the binding of inner-most enclosing test or hook when
|
916
|
+
debugging or constructing a failure report for an assertion that was
|
917
|
+
not given a block.</p>
|
918
|
+
|
919
|
+
<p>This allows you to reduce "line noise" in your tests:</p>
|
920
|
+
|
921
|
+
<pre><code>D "Lottery" do
|
922
|
+
winning_ticket = rand()
|
923
|
+
|
924
|
+
D "My chances of winning" do
|
925
|
+
my_ticket = rand()
|
926
|
+
F my_ticket == winning_ticket, "I won?! Dream on."
|
927
|
+
end
|
928
|
+
end
|
929
|
+
</code></pre></li>
|
930
|
+
<li><p>Add <code>Dfect::S()</code> methods for sharing code between tests.</p></li>
|
931
|
+
<li><p>Add <code>Dfect::D!()</code> method to explicitly insulate a test from other
|
932
|
+
tests, the top-level Ruby environment, and the code being tested.</p></li>
|
933
|
+
<li><p>Add <code>Dfect::info()</code> method which returns the details of
|
934
|
+
the failure that is currently being debugged by the user.</p></li>
|
935
|
+
<li><p>Add instance variables to the <code>:vars</code> section of a failure report.</p></li>
|
936
|
+
<li><p>Add <code>setup!()</code> and <code>teardown!()</code> methods for before-all and
|
937
|
+
after-all hooks in the dfect/unit emulation library.</p></li>
|
938
|
+
<li><p>Add test execution time to statistics hash (under the <code>:time</code> key).</p></li>
|
939
|
+
</ul>
|
940
|
+
|
941
|
+
|
942
|
+
<p>Bug fixes:</p>
|
943
|
+
|
944
|
+
<ul>
|
945
|
+
<li><p>Do not print any output when <code>:quiet</code> option is active.</p></li>
|
946
|
+
<li><p>Allow passing multiple strings/objects to <code>Dfect::D()</code> like in RSpec.</p></li>
|
947
|
+
<li><p>Make before and after hook methods mixin-able like assertions.</p></li>
|
948
|
+
<li><p>Do not assume that <code>Module#to_s</code> is the same as <code>Module#name</code>.</p></li>
|
949
|
+
</ul>
|
950
|
+
|
951
|
+
|
952
|
+
<p>Housekeeping:</p>
|
953
|
+
|
954
|
+
<ul>
|
955
|
+
<li><p>Upgrade to Inochi 2.0.0-rc1 for managing this project.</p></li>
|
956
|
+
<li><p>Make emulation libraries modify Dfect module instead of Kernel.</p></li>
|
957
|
+
<li><p>Do not pollute the user's output with our <code>Class#to_yaml</code> workaround.</p></li>
|
958
|
+
<li><p>Remove "Motivation" section from user manual. It was too fanatic!</p></li>
|
959
|
+
</ul>
|
960
|
+
|
961
|
+
|
962
|
+
<h3 id="Version-1-1-0-2009-10-27-">Version 1.1.0 (2009-10-27)</h3>
|
963
|
+
|
964
|
+
<p>This release adds a new method for emitting status messages and does some
|
965
|
+
internal housekeeping.</p>
|
966
|
+
|
967
|
+
<p>Thank you:</p>
|
968
|
+
|
969
|
+
<ul>
|
970
|
+
<li>Iñaki Baz Castillo used Dfect and suggested new features.</li>
|
971
|
+
</ul>
|
972
|
+
|
973
|
+
|
974
|
+
<p>New features:</p>
|
975
|
+
|
976
|
+
<ul>
|
977
|
+
<li>Add <code>Dfect::S()</code> method for adding status messages to the
|
978
|
+
execution report. This feature was <a href="http://github.com/sunaku/dfect/issues/1">requested
|
979
|
+
by</a> Iñaki Baz Castillo.</li>
|
980
|
+
</ul>
|
981
|
+
|
982
|
+
|
983
|
+
<p>Housekeeping:</p>
|
984
|
+
|
985
|
+
<ul>
|
986
|
+
<li><p>Remove unused require of 'delegate' standard library in 'dfect/spec'
|
987
|
+
RSpec emulation layer.</p></li>
|
988
|
+
<li><p>Mention emulation layers for popular testing libraries.</p></li>
|
989
|
+
<li><p>Mention that assertions take an optional message parameter.</p></li>
|
990
|
+
<li><p>Replace sample unit test with Dfect test suite.</p></li>
|
991
|
+
<li><p>Upgrade user manual to ERBook 9.0.0.</p></li>
|
992
|
+
</ul>
|
993
|
+
|
994
|
+
|
995
|
+
<h3 id="Version-1-0-1-2009-10-07-">Version 1.0.1 (2009-10-07)</h3>
|
996
|
+
|
997
|
+
<p>This release fixes a bug in the <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a> emulation library and revises the
|
998
|
+
user manual.</p>
|
999
|
+
|
1000
|
+
<p>Bug fixes:</p>
|
1001
|
+
|
1002
|
+
<ul>
|
1003
|
+
<li>The parameters for the <code>assert_equal()</code> method in the
|
1004
|
+
dfect/unit library were in the wrong order.</li>
|
1005
|
+
</ul>
|
1006
|
+
|
1007
|
+
|
1008
|
+
<p>Housekeeping:</p>
|
1009
|
+
|
1010
|
+
<ul>
|
1011
|
+
<li><p>Revise user manual to better fit jQuery UI tabs.</p></li>
|
1012
|
+
<li><p>Justify the use of <code>eval()</code> in emulation libraries.</p></li>
|
1013
|
+
<li><p>Use simpler Copyright reminder at the top of every file.</p></li>
|
1014
|
+
<li><p>Make SLOC count in user manual reflect the <em>core</em> library only.</p></li>
|
1015
|
+
<li><p>Mark code spans with <code>{:lang=ruby}</code> instead of HTML <code><code/></code> tags.</p></li>
|
1016
|
+
<li><p>Open source is for fun, so <a href="http://loiclemeur.com/english/2009/03/never-criticize-your-competitors.html">be nice</a> and speak of "related works" instead of "competitors".</p></li>
|
1017
|
+
</ul>
|
1018
|
+
|
1019
|
+
|
1020
|
+
<h3 id="Version-1-0-0-2009-05-03-">Version 1.0.0 (2009-05-03)</h3>
|
1021
|
+
|
1022
|
+
<p>This release improves default choices, adds emulation layers to mimic other
|
1023
|
+
testing libraries, and fixes some bugs.</p>
|
1024
|
+
|
1025
|
+
<p>Incompatible changes:</p>
|
1026
|
+
|
1027
|
+
<ul>
|
1028
|
+
<li><p>The <code>:debug</code> option is now enabled by default and is no longer linked to
|
1029
|
+
the value of <code>$DEBUG</code>.</p></li>
|
1030
|
+
<li><p><code>Dfect.run()</code> now appends to previous results by default.</p>
|
1031
|
+
|
1032
|
+
<p>This behavior can be disabled by passing <code>false</code> to the method.</p></li>
|
1033
|
+
</ul>
|
1034
|
+
|
1035
|
+
|
1036
|
+
<p>New features:</p>
|
1037
|
+
|
1038
|
+
<ul>
|
1039
|
+
<li>Add emulation layers to mimic other testing libraries:
|
1040
|
+
|
1041
|
+
<ul>
|
1042
|
+
<li>dfect/unit --- <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a></li>
|
1043
|
+
<li>dfect/mini --- <a href="http://blog.zenspider.com/minitest/">Minitest</a></li>
|
1044
|
+
<li>dfect/spec --- <a href="http://rspec.info">RSpec</a></li>
|
1045
|
+
</ul>
|
1046
|
+
</li>
|
1047
|
+
</ul>
|
1048
|
+
|
1049
|
+
|
1050
|
+
<p>Bug fixes:</p>
|
1051
|
+
|
1052
|
+
<ul>
|
1053
|
+
<li>Do not blindly replace <code>Class#to_yaml</code>; it might be fixed someday.</li>
|
1054
|
+
</ul>
|
1055
|
+
|
1056
|
+
|
1057
|
+
<p>Housekeeping:</p>
|
1058
|
+
|
1059
|
+
<ul>
|
1060
|
+
<li><p>Add "Motivation" section in user manual to promote interactive
|
1061
|
+
debugging.</p></li>
|
1062
|
+
<li><p>Add brief History of this project's inception.</p></li>
|
1063
|
+
<li><p>Remove redundant assertions for F!() and T!() methods in test suite.</p></li>
|
1064
|
+
<li><p>Add copyright notice at the top of every file.</p></li>
|
1065
|
+
</ul>
|
1066
|
+
|
1067
|
+
|
1068
|
+
<h3 id="Version-0-1-0-2009-04-28-">Version 0.1.0 (2009-04-28)</h3>
|
1069
|
+
|
1070
|
+
<p>This release adds new variations to assertion methods, fixes several bugs,
|
1071
|
+
and improves test coverage.</p>
|
1072
|
+
|
1073
|
+
<p>Thank you:</p>
|
1074
|
+
|
1075
|
+
<ul>
|
1076
|
+
<li>François Beausoleil contributed patches for both code <em>and</em> tests! :-)</li>
|
1077
|
+
</ul>
|
1078
|
+
|
1079
|
+
|
1080
|
+
<p>New features:</p>
|
1081
|
+
|
1082
|
+
<ul>
|
1083
|
+
<li><p>Added negation (m!) and sampling (m?) variations to normal assertion
|
1084
|
+
methods. These new methods implement assertion functionality missing so
|
1085
|
+
far (previously we could not assert that a given exception was NOT thrown)
|
1086
|
+
and thereby allow us to fully test Dfect using itself.</p></li>
|
1087
|
+
<li><p>Added documentation on how to insulate tests from the global Ruby
|
1088
|
+
namespace.</p></li>
|
1089
|
+
</ul>
|
1090
|
+
|
1091
|
+
|
1092
|
+
<p>Bug fixes:</p>
|
1093
|
+
|
1094
|
+
<ul>
|
1095
|
+
<li><p>The <code>E()</code> method did not consider the case where a block does not raise
|
1096
|
+
anything as a failure. ---<em>François Beausoleil</em></p></li>
|
1097
|
+
<li><p>When creating a report about an assertion failure, an exception would be
|
1098
|
+
thrown if any local variables pointed to an empty array.</p></li>
|
1099
|
+
<li><p>The <code>Dfect::<()</code> method broke the inheritance-checking behavior of the <
|
1100
|
+
class method.</p>
|
1101
|
+
|
1102
|
+
<p>Added a bypass to the originial behavior so that <code>RCov::XX</code> can properly
|
1103
|
+
generate a report about code that uses Dfect.</p></li>
|
1104
|
+
<li><p>Added workaround for YAML error when serializing a class object:</p>
|
1105
|
+
|
1106
|
+
<pre><code>TypeError: can't dump anonymous class Class
|
1107
|
+
</code></pre></li>
|
1108
|
+
</ul>
|
1109
|
+
|
1110
|
+
|
1111
|
+
<p>Housekeeping:</p>
|
1112
|
+
|
1113
|
+
<ul>
|
1114
|
+
<li>Filled the big holes in test coverage. Everything except the runtime
|
1115
|
+
debugging logic is now covered by the unit tests.</li>
|
1116
|
+
</ul>
|
1117
|
+
|
1118
|
+
|
1119
|
+
<h3 id="Version-0-0-0-2009-04-13-">Version 0.0.0 (2009-04-13)</h3>
|
1120
|
+
|
1121
|
+
<p>For the longest time, I took <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html">Test::Unit</a> and <a href="http://rspec.info">RSpec</a> for granted. They were
|
1122
|
+
the epitomy of modern Ruby practice; the insurmountable status quo;
|
1123
|
+
immortalized in books, conferences, and blogs alike.</p>
|
1124
|
+
|
1125
|
+
<p>Why would <em>anyone</em> think of using anything remotely different, let alone be
|
1126
|
+
foolish enough to write an alternative testing library when these are clearly
|
1127
|
+
<em>good enough</em>?</p>
|
1128
|
+
|
1129
|
+
<p>Recent experiments in assertion testing libraries smashed my world view:</p>
|
1130
|
+
|
1131
|
+
<ul>
|
1132
|
+
<li><a href="http://assert2.rubyforge.org">assert{ 2.0 }</a></li>
|
1133
|
+
<li><a href="http://github.com/ahoward/testy/tree/master">Testy</a></li>
|
1134
|
+
<li><a href="http://www.ruby-forum.com/topic/183354">Verify</a></li>
|
1135
|
+
</ul>
|
1136
|
+
|
1137
|
+
|
1138
|
+
<p>The status quo was certainly <em>not</em> "good enough", as I had so blindly
|
1139
|
+
believed all these years. In fact, they were <em>verbose</em> behemoths that chose
|
1140
|
+
to encode endless permutations of conjecture into methods.</p>
|
1141
|
+
|
1142
|
+
<p>Empowered by this revelation and inspired by <a href="http://www.ruby-forum.com/topic/183354#801895">Sean O'Halpin's musing</a> on alternative names for
|
1143
|
+
assertion methods, I rose to challenge the status quo.</p>
|
1144
|
+
|
1145
|
+
<p>And so I present to you the first public release of "Dfect".</p>
|
1146
|
+
|
1147
|
+
<h2 id="AUTHORS">AUTHORS</h2>
|
1148
|
+
|
1149
|
+
<p>Suraj N. Kurapati</p>
|
1150
|
+
|
1151
|
+
<h2 id="CREDITS">CREDITS</h2>
|
1152
|
+
|
1153
|
+
<p>François Beausoleil,
|
1154
|
+
Gavin Sinclair,
|
1155
|
+
Iñaki Baz Castillo,
|
1156
|
+
Sean O'Halpin</p>
|
1157
|
+
|
1158
|
+
<h2 id="LICENSE">LICENSE</h2>
|
1159
|
+
|
1160
|
+
<p>(the ISC license)</p>
|
1161
|
+
|
1162
|
+
<p>Copyright 2009 Suraj N. Kurapati <a href="mailto:sunaku@gmail.com" data-bare-link="true">sunaku@gmail.com</a></p>
|
1163
|
+
|
1164
|
+
<p>Permission to use, copy, modify, and/or distribute this software for any
|
1165
|
+
purpose with or without fee is hereby granted, provided that the above
|
1166
|
+
copyright notice and this permission notice appear in all copies.</p>
|
1167
|
+
|
1168
|
+
<p>THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
1169
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
1170
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
1171
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
1172
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
1173
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
1174
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p>
|
1175
|
+
|
1176
|
+
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
1177
|
+
|
1178
|
+
<p><a href="http://assert2.rubyforge.org">assert{ 2.0 }</a>,
|
1179
|
+
<a href="http://github.com/ahoward/testy/tree/master">Testy</a>,
|
1180
|
+
<a href="http://www.ruby-forum.com/topic/183354">Verify</a></p>
|
1181
|
+
|
1182
|
+
|
1183
|
+
<ol class='man-decor man-foot man foot'>
|
1184
|
+
<li class='tl'></li>
|
1185
|
+
<li class='tc'>July 2010</li>
|
1186
|
+
<li class='tr'>difects(1)</li>
|
1187
|
+
</ol>
|
1188
|
+
|
1189
|
+
</div>
|
1190
|
+
</body>
|
1191
|
+
</html>
|