quicktest 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +91 -47
- data/doc/created.rid +1 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +28 -0
- data/doc/fr_method_index.html +36 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/quicktest.rb +4 -0
- data/pkg/quicktest-0.3.2.gem +0 -0
- data/rakefile +57 -1
- data/test/test.rb +5 -0
- data/test/test_result.txt +31 -31
- metadata +13 -2
data/README
CHANGED
@@ -1,21 +1,53 @@
|
|
1
1
|
=begin rdoc
|
2
|
-
== Author and License
|
3
|
-
Copyright (c) 2008 Greg Weber, http://gregweber.info
|
4
|
-
Licensed under the MIT license
|
5
2
|
|
6
|
-
==
|
3
|
+
== Summary
|
7
4
|
Quicktest - A utility for inlining ruby unit tests with the ruby code under test
|
8
5
|
|
9
|
-
|
6
|
+
== Example
|
7
|
+
run with bin/quickspec
|
10
8
|
|
11
|
-
|
9
|
+
=end rdoc
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
class Foo
|
12
|
+
def initialize
|
13
|
+
@bar = true
|
14
|
+
end
|
15
|
+
def quicktest
|
16
|
+
it "bar should be initialized to true" do
|
17
|
+
@bar.should == true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.hello arg
|
22
|
+
"hello" + arg
|
23
|
+
end
|
24
|
+
def self.quicktest meth
|
25
|
+
it "should prepend 'hello' to its argument" do
|
26
|
+
meth["world"].should == 'hello world' # error - no space 'helloworld'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
=begin rdoc
|
15
32
|
|
16
|
-
|
33
|
+
Running quicktest on the source of this README file outputs the following:
|
34
|
+
.F
|
35
|
+
|
36
|
+
1)
|
37
|
+
'Foo hello should prepend 'hello' to its argument' FAILED
|
38
|
+
expected: "hello world",
|
39
|
+
got: "helloworld" (using ==)
|
40
|
+
./README:22:in `quicktest'
|
41
|
+
/home/greg/quicktest/lib/quicktest.rb:65:in `instance_eval'
|
42
|
+
/home/greg/quicktest/lib/quicktest.rb:65:in `run_tests'
|
43
|
+
|
44
|
+
Finished in 0.008338 seconds
|
45
|
+
|
46
|
+
2 examples, 1 failure
|
47
|
+
|
48
|
+
== Usage
|
17
49
|
To test a method, place another method called 'quicktest' immediately after it
|
18
|
-
the quicktest method has one OPTIONAL argument
|
50
|
+
the quicktest method has one OPTIONAL argument:
|
19
51
|
- a method object for the method under test
|
20
52
|
|
21
53
|
run with
|
@@ -26,50 +58,62 @@ There is a convenience script so that you can just run
|
|
26
58
|
|
27
59
|
quickspec file_to_test
|
28
60
|
|
29
|
-
==
|
30
|
-
|
31
|
-
|
61
|
+
== Author and License
|
62
|
+
Copyright (c) 2008 Greg Weber, http://gregweber.info
|
63
|
+
Licensed under the MIT license
|
32
64
|
|
65
|
+
== About
|
33
66
|
|
34
|
-
|
35
|
-
=end rdoc
|
67
|
+
The typical test driven development workflow requires constant switching between the file containg the source code and the the file containg the tests. When creating code, it is much faster to be able to place tests immediately after the code you are writing. After the code has been written, it may be a good idea to move it to another file.
|
36
68
|
|
37
|
-
|
38
|
-
attr_reader :bar
|
69
|
+
Quicktest is designed to support quick tests in a framework agnostic way. Currently, only an rspec testrunner is available, but it is trivial to write one for another testing framework.
|
39
70
|
|
40
|
-
|
41
|
-
@bar = true
|
42
|
-
end
|
43
|
-
def quicktest
|
44
|
-
it "bar should be initialized to true" do
|
45
|
-
bar.should == true
|
46
|
-
end
|
47
|
-
end
|
71
|
+
Quicktest uses method tracing to know the method you are testing. By default the output of a failed test will show the object and method name.
|
48
72
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
73
|
+
== Install
|
74
|
+
gem instlal quicktest
|
75
|
+
|
76
|
+
== Source
|
77
|
+
=== browser
|
78
|
+
http://github.com/gregwebs/quicktest/tree/master
|
79
|
+
=== repository
|
80
|
+
git clone git://github.com/gregwebs/quicktest.git
|
81
|
+
|
82
|
+
== Homepage
|
83
|
+
http://gregweber.info/projects/quicktest.html
|
84
|
+
|
85
|
+
== RDoc documentation
|
86
|
+
http://quicktest.rubyforge.org/
|
58
87
|
|
59
|
-
|
88
|
+
== Important Notes
|
89
|
+
- def quicktest will instantiate an object for the class you are testing, which gives a convenient referenct to self in the quicktest method. However, it calls new() without any parameters. If you need parameters for new(), you will have to use def self.quicktest.
|
90
|
+
- quicktest methods not working properly? if the class (or one of its ancestors) is overriding method tracing then including QuickTest::Tracer will fix it.
|
60
91
|
|
61
|
-
|
62
|
-
|
92
|
+
== Unimportant Notes
|
93
|
+
=== production performance
|
94
|
+
leaving test code in with your production code is not necessarily a good idea, but there is almost no runtime overhead to doing so since ruby will not evaluate code in a method until the method is invoked
|
63
95
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
96
|
+
=== rationals
|
97
|
+
* tests for scripts
|
98
|
+
Definitely very useful for one file scripts, or any type of code that does not have a well established project home where the tests will be. You can distribute the tests with script so that anyone who wants to modify it can also modify the tests instead of assuming the original author did not write any.
|
99
|
+
You can have a flow of development where a 'quick and dirty' script becomes well tested. Here is a shell function that tests the file before every run.
|
100
|
+
function test_run () { quickspec $1 && $1 }
|
101
|
+
* documentation
|
102
|
+
Tests are a form of documentation. It can be argued that it is better to have all documentation include in the source
|
71
103
|
|
72
|
-
|
104
|
+
* efficient TDD
|
105
|
+
When writing fresh code you now have the possibility to be directly next to the code under test without having to switch back and forth between files. When you are done writing the new code, you can easily pull all the quicktest methods out and into a spec file.
|
73
106
|
|
74
|
-
|
75
|
-
|
107
|
+
|
108
|
+
=== Origins
|
109
|
+
Quicktest came out of my dabbling in the D programming language, which allows you to place testing blocks inline with your source code
|
110
|
+
unittest{
|
111
|
+
...
|
112
|
+
}
|
113
|
+
|
114
|
+
Normally, these blocks are ignored, but if you compile with a different switch, they are linked in and ran at the beginning of your program.
|
115
|
+
Originally, I made an exact copy of this, but among other things, it requires the placement of a line like
|
116
|
+
(def unittest;end) if not defined? unittest
|
117
|
+
at the beginning of the file. It would be nice if Ruby had a similar construct built in to the language.
|
118
|
+
|
119
|
+
=end rdoc
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thu, 06 Mar 2008 23:06:11 -0600
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/QuickTest.html">QuickTest</a><br />
|
24
|
+
<a href="classes/QuickTest/RSpecTestRunner.html">QuickTest::RSpecTestRunner</a><br />
|
25
|
+
<a href="classes/QuickTest/TestRunner.html">QuickTest::TestRunner</a><br />
|
26
|
+
<a href="classes/QuickTest/Tracer.html">QuickTest::Tracer</a><br />
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Files
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Files</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Files</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="files/README.html">README</a><br />
|
24
|
+
<a href="files/lib/quicktest_rb.html">lib/quicktest.rb</a><br />
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/QuickTest/TestRunner.html#M000008">add_method (QuickTest::TestRunner)</a><br />
|
24
|
+
<a href="classes/QuickTest/TestRunner.html#M000009">add_singleton_method (QuickTest::TestRunner)</a><br />
|
25
|
+
<a href="classes/QuickTest/RSpecTestRunner.html#M000006">after (QuickTest::RSpecTestRunner)</a><br />
|
26
|
+
<a href="classes/QuickTest/RSpecTestRunner.html#M000005">before (QuickTest::RSpecTestRunner)</a><br />
|
27
|
+
<a href="classes/QuickTest/Tracer.html#M000001">included (QuickTest::Tracer)</a><br />
|
28
|
+
<a href="classes/QuickTest/RSpecTestRunner.html#M000007">it (QuickTest::RSpecTestRunner)</a><br />
|
29
|
+
<a href="classes/QuickTest/Tracer.html#M000004">method_added (QuickTest::Tracer)</a><br />
|
30
|
+
<a href="classes/QuickTest/TestRunner.html#M000010">new (QuickTest::TestRunner)</a><br />
|
31
|
+
<a href="classes/QuickTest/Tracer.html#M000003">singleton_method_added (QuickTest::Tracer)</a><br />
|
32
|
+
<a href="classes/QuickTest/Tracer.html#M000002">tracer_include (QuickTest::Tracer)</a><br />
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</body>
|
36
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
RDoc Documentation
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>RDoc Documentation</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/README.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|
data/doc/rdoc-style.css
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
|
2
|
+
body {
|
3
|
+
font-family: Verdana,Arial,Helvetica,sans-serif;
|
4
|
+
font-size: 90%;
|
5
|
+
margin: 0;
|
6
|
+
margin-left: 40px;
|
7
|
+
padding: 0;
|
8
|
+
background: white;
|
9
|
+
}
|
10
|
+
|
11
|
+
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
|
12
|
+
h1 { font-size: 150%; }
|
13
|
+
h2,h3,h4 { margin-top: 1em; }
|
14
|
+
|
15
|
+
a { background: #eef; color: #039; text-decoration: none; }
|
16
|
+
a:hover { background: #039; color: #eef; }
|
17
|
+
|
18
|
+
/* Override the base stylesheet's Anchor inside a table cell */
|
19
|
+
td > a {
|
20
|
+
background: transparent;
|
21
|
+
color: #039;
|
22
|
+
text-decoration: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* and inside a section title */
|
26
|
+
.section-title > a {
|
27
|
+
background: transparent;
|
28
|
+
color: #eee;
|
29
|
+
text-decoration: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
/* === Structural elements =================================== */
|
33
|
+
|
34
|
+
div#index {
|
35
|
+
margin: 0;
|
36
|
+
margin-left: -40px;
|
37
|
+
padding: 0;
|
38
|
+
font-size: 90%;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
div#index a {
|
43
|
+
margin-left: 0.7em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div#index .section-bar {
|
47
|
+
margin-left: 0px;
|
48
|
+
padding-left: 0.7em;
|
49
|
+
background: #ccc;
|
50
|
+
font-size: small;
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
div#classHeader, div#fileHeader {
|
55
|
+
width: auto;
|
56
|
+
color: white;
|
57
|
+
padding: 0.5em 1.5em 0.5em 1.5em;
|
58
|
+
margin: 0;
|
59
|
+
margin-left: -40px;
|
60
|
+
border-bottom: 3px solid #006;
|
61
|
+
}
|
62
|
+
|
63
|
+
div#classHeader a, div#fileHeader a {
|
64
|
+
background: inherit;
|
65
|
+
color: white;
|
66
|
+
}
|
67
|
+
|
68
|
+
div#classHeader td, div#fileHeader td {
|
69
|
+
background: inherit;
|
70
|
+
color: white;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
div#fileHeader {
|
75
|
+
background: #057;
|
76
|
+
}
|
77
|
+
|
78
|
+
div#classHeader {
|
79
|
+
background: #048;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
.class-name-in-header {
|
84
|
+
font-size: 180%;
|
85
|
+
font-weight: bold;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
div#bodyContent {
|
90
|
+
padding: 0 1.5em 0 1.5em;
|
91
|
+
}
|
92
|
+
|
93
|
+
div#description {
|
94
|
+
padding: 0.5em 1.5em;
|
95
|
+
background: #efefef;
|
96
|
+
border: 1px dotted #999;
|
97
|
+
}
|
98
|
+
|
99
|
+
div#description h1,h2,h3,h4,h5,h6 {
|
100
|
+
color: #125;;
|
101
|
+
background: transparent;
|
102
|
+
}
|
103
|
+
|
104
|
+
div#validator-badges {
|
105
|
+
text-align: center;
|
106
|
+
}
|
107
|
+
div#validator-badges img { border: 0; }
|
108
|
+
|
109
|
+
div#copyright {
|
110
|
+
color: #333;
|
111
|
+
background: #efefef;
|
112
|
+
font: 0.75em sans-serif;
|
113
|
+
margin-top: 5em;
|
114
|
+
margin-bottom: 0;
|
115
|
+
padding: 0.5em 2em;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
/* === Classes =================================== */
|
120
|
+
|
121
|
+
table.header-table {
|
122
|
+
color: white;
|
123
|
+
font-size: small;
|
124
|
+
}
|
125
|
+
|
126
|
+
.type-note {
|
127
|
+
font-size: small;
|
128
|
+
color: #DEDEDE;
|
129
|
+
}
|
130
|
+
|
131
|
+
.xxsection-bar {
|
132
|
+
background: #eee;
|
133
|
+
color: #333;
|
134
|
+
padding: 3px;
|
135
|
+
}
|
136
|
+
|
137
|
+
.section-bar {
|
138
|
+
color: #333;
|
139
|
+
border-bottom: 1px solid #999;
|
140
|
+
margin-left: -20px;
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
.section-title {
|
145
|
+
background: #79a;
|
146
|
+
color: #eee;
|
147
|
+
padding: 3px;
|
148
|
+
margin-top: 2em;
|
149
|
+
margin-left: -30px;
|
150
|
+
border: 1px solid #999;
|
151
|
+
}
|
152
|
+
|
153
|
+
.top-aligned-row { vertical-align: top }
|
154
|
+
.bottom-aligned-row { vertical-align: bottom }
|
155
|
+
|
156
|
+
/* --- Context section classes ----------------------- */
|
157
|
+
|
158
|
+
.context-row { }
|
159
|
+
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
|
160
|
+
.context-item-value { font-size: small; color: #448; }
|
161
|
+
.context-item-desc { color: #333; padding-left: 2em; }
|
162
|
+
|
163
|
+
/* --- Method classes -------------------------- */
|
164
|
+
.method-detail {
|
165
|
+
background: #efefef;
|
166
|
+
padding: 0;
|
167
|
+
margin-top: 0.5em;
|
168
|
+
margin-bottom: 1em;
|
169
|
+
border: 1px dotted #ccc;
|
170
|
+
}
|
171
|
+
.method-heading {
|
172
|
+
color: black;
|
173
|
+
background: #ccc;
|
174
|
+
border-bottom: 1px solid #666;
|
175
|
+
padding: 0.2em 0.5em 0 0.5em;
|
176
|
+
}
|
177
|
+
.method-signature { color: black; background: inherit; }
|
178
|
+
.method-name { font-weight: bold; }
|
179
|
+
.method-args { font-style: italic; }
|
180
|
+
.method-description { padding: 0 0.5em 0 0.5em; }
|
181
|
+
|
182
|
+
/* --- Source code sections -------------------- */
|
183
|
+
|
184
|
+
a.source-toggle { font-size: 90%; }
|
185
|
+
div.method-source-code {
|
186
|
+
background: #262626;
|
187
|
+
color: #ffdead;
|
188
|
+
margin: 1em;
|
189
|
+
padding: 0.5em;
|
190
|
+
border: 1px dashed #999;
|
191
|
+
overflow: hidden;
|
192
|
+
}
|
193
|
+
|
194
|
+
div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
195
|
+
|
196
|
+
/* --- Ruby keyword styles --------------------- */
|
197
|
+
|
198
|
+
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
|
199
|
+
|
200
|
+
.ruby-constant { color: #7fffd4; background: transparent; }
|
201
|
+
.ruby-keyword { color: #00ffff; background: transparent; }
|
202
|
+
.ruby-ivar { color: #eedd82; background: transparent; }
|
203
|
+
.ruby-operator { color: #00ffee; background: transparent; }
|
204
|
+
.ruby-identifier { color: #ffdead; background: transparent; }
|
205
|
+
.ruby-node { color: #ffa07a; background: transparent; }
|
206
|
+
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
|
207
|
+
.ruby-regexp { color: #ffa07a; background: transparent; }
|
208
|
+
.ruby-value { color: #7fffd4; background: transparent; }
|
data/lib/quicktest.rb
CHANGED
Binary file
|
data/rakefile
CHANGED
@@ -23,6 +23,62 @@ namespace :test do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
class IO
|
27
|
+
def self.write( file, str )
|
28
|
+
self.open( file, 'w' ) { |fh| fh.print str }
|
29
|
+
end
|
30
|
+
def self.read_write( file, write_file=file )
|
31
|
+
self.write(write_file, (yield( self.read( file ))))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
class String
|
35
|
+
def split_join( splitter=$/ )
|
36
|
+
yield( split( splitter ) ).join( splitter )
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def decode_readme &block
|
41
|
+
fail unless block_given?
|
42
|
+
begin
|
43
|
+
old_readme = nil
|
44
|
+
File.read_write( 'README' ) do |text|
|
45
|
+
old_readme = text
|
46
|
+
text.split_join do |arr|
|
47
|
+
arr.reject {|l| l =~ /^=(?:begin|end)/}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
block.call
|
51
|
+
ensure
|
52
|
+
File.write( 'README', old_readme ) if old_readme
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "generate documentation"
|
57
|
+
task :rdoc do
|
58
|
+
decode_readme do
|
59
|
+
fail unless system 'rdoc --force-update --quiet README lib/*'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
namespace :readme do
|
64
|
+
desc "dump modified README"
|
65
|
+
task :decode do
|
66
|
+
decode_readme do
|
67
|
+
puts File.read('README')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
desc "create html for website using coderay"
|
72
|
+
task :html => :rdoc do
|
73
|
+
require 'hpricot'
|
74
|
+
doc = open( 'doc/files/README.html' ) { |f| Hpricot(f) }
|
75
|
+
# find example code
|
76
|
+
ex = doc.at('#description').search('pre').select {|elem| elem.inner_html =~ /def self\.quicktest/}.first
|
77
|
+
ex.swap("<coderay lang='ruby'>#{ex.inner_html}</coderay>")
|
78
|
+
# undo what rdoc has done in the example code
|
79
|
+
puts doc.at('#description').to_html.gsub('"', '"')
|
80
|
+
end
|
81
|
+
end
|
26
82
|
|
27
83
|
require 'rubygems'
|
28
84
|
require 'rake/gempackagetask'
|
@@ -30,7 +86,7 @@ require 'rake/gempackagetask'
|
|
30
86
|
spec = Gem::Specification.new do |s|
|
31
87
|
s.name = "quicktest"
|
32
88
|
s.rubyforge_project = "quicktest"
|
33
|
-
s.version = "0.3.
|
89
|
+
s.version = "0.3.4"
|
34
90
|
s.author = "Greg Weber"
|
35
91
|
s.email = "greg@gregweber.info"
|
36
92
|
s.homepage = "http://quicktest.rubyfore.org/"
|
data/test/test.rb
CHANGED
@@ -5,6 +5,11 @@
|
|
5
5
|
# regenerate and run
|
6
6
|
# spec -r ../lib/quicktest test.rb >| test_result.txt || spec -r ../lib/quicktest test.rb
|
7
7
|
|
8
|
+
def quicktest
|
9
|
+
it "should be of class Object" do
|
10
|
+
self.should be_kind_of(Object)
|
11
|
+
end
|
12
|
+
end
|
8
13
|
# all tests for this class should always pass
|
9
14
|
class Tester
|
10
15
|
def self.meth
|
data/test/test_result.txt
CHANGED
@@ -1,69 +1,69 @@
|
|
1
|
-
|
1
|
+
.....FFFFFFFF
|
2
2
|
|
3
3
|
1)
|
4
|
-
'#<Object:
|
4
|
+
'#<Object:0xb787b240> should show class name in output' FAILED
|
5
5
|
expected: /^'#<Object:0x[^>]+> should show class name in output' FAILED$/,
|
6
6
|
got: nil (using =~)
|
7
|
-
./test.rb:
|
8
|
-
|
9
|
-
|
7
|
+
./test.rb:58:in `quicktest'
|
8
|
+
../lib/quicktest.rb:91:in `call'
|
9
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
10
10
|
|
11
11
|
2)
|
12
|
-
'#<Object:
|
12
|
+
'#<Object:0xb787a548> new_method_added should show name of added method' FAILED
|
13
13
|
expected: /^'#<Object:0x[^>]+> new_method_added should show name of added method' FAILED$/,
|
14
14
|
got: nil (using =~)
|
15
|
-
./test.rb:
|
16
|
-
|
17
|
-
|
15
|
+
./test.rb:68:in `quicktest'
|
16
|
+
../lib/quicktest.rb:91:in `call'
|
17
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
18
18
|
|
19
19
|
3)
|
20
20
|
'TestModule should show class name in output' FAILED
|
21
21
|
expected: /^'TestModule should show class name in output' FAILED$/,
|
22
22
|
got: nil (using =~)
|
23
|
-
./test.rb:
|
24
|
-
|
25
|
-
|
23
|
+
./test.rb:78:in `quicktest'
|
24
|
+
../lib/quicktest.rb:91:in `call'
|
25
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
26
26
|
|
27
27
|
4)
|
28
28
|
'TestModule new_singleton_method_added should show class name in output' FAILED
|
29
29
|
expected: /^'TestModule new_singleton_method_added should show class name in output' FAILED$/,
|
30
30
|
got: nil (using =~)
|
31
|
-
./test.rb:
|
32
|
-
|
33
|
-
|
31
|
+
./test.rb:89:in `quicktest'
|
32
|
+
../lib/quicktest.rb:91:in `call'
|
33
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
34
34
|
|
35
35
|
5)
|
36
36
|
'TestClass should show class name in output' FAILED
|
37
37
|
expected: /^'TestClass should show class name in output' FAILED$/,
|
38
38
|
got: nil (using =~)
|
39
|
-
./test.rb:
|
40
|
-
|
41
|
-
|
39
|
+
./test.rb:100:in `quicktest'
|
40
|
+
../lib/quicktest.rb:91:in `call'
|
41
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
42
42
|
|
43
43
|
6)
|
44
|
-
'#<TestClass:
|
44
|
+
'#<TestClass:0xb7877c94> should show class name in output' FAILED
|
45
45
|
expected: /^'#<TestClass:0x[^>]+> should show class name in output' FAILED$/,
|
46
46
|
got: nil (using =~)
|
47
|
-
./test.rb:
|
48
|
-
|
49
|
-
|
47
|
+
./test.rb:107:in `quicktest'
|
48
|
+
../lib/quicktest.rb:91:in `call'
|
49
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
50
50
|
|
51
51
|
7)
|
52
|
-
'#<TestClass:
|
52
|
+
'#<TestClass:0xb78763bc> new_method_added should show name of added method' FAILED
|
53
53
|
expected: /^'#<TestClass:0x[^>]+> new_method_added should show name of added method' FAILED$/,
|
54
54
|
got: nil (using =~)
|
55
|
-
./test.rb:
|
56
|
-
|
57
|
-
|
55
|
+
./test.rb:117:in `quicktest'
|
56
|
+
../lib/quicktest.rb:91:in `call'
|
57
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
58
58
|
|
59
59
|
8)
|
60
60
|
'TestClass new_singleton_method_added should show class name in output' FAILED
|
61
61
|
expected: /^'TestClass new_singleton_method_added should show class name in output' FAILED$/,
|
62
62
|
got: nil (using =~)
|
63
|
-
./test.rb:
|
64
|
-
|
65
|
-
|
63
|
+
./test.rb:128:in `quicktest'
|
64
|
+
../lib/quicktest.rb:91:in `call'
|
65
|
+
../lib/quicktest.rb:91:in `__quicktest_run_tests__'
|
66
66
|
|
67
|
-
Finished in 0.
|
67
|
+
Finished in 0.182849 seconds
|
68
68
|
|
69
|
-
|
69
|
+
13 examples, 8 failures
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: quicktest
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2008-
|
6
|
+
version: 0.3.4
|
7
|
+
date: 2008-03-07 00:00:00 -06:00
|
8
8
|
summary: utility for inlining tests with the code tested
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,12 +30,23 @@ authors:
|
|
30
30
|
- Greg Weber
|
31
31
|
files:
|
32
32
|
- ./bin
|
33
|
+
- ./doc
|
33
34
|
- ./lib
|
35
|
+
- ./pkg
|
34
36
|
- ./test
|
35
37
|
- ./README
|
36
38
|
- ./rakefile
|
37
39
|
- bin/quickspec
|
40
|
+
- doc/files
|
41
|
+
- doc/index.html
|
42
|
+
- doc/rdoc-style.css
|
43
|
+
- doc/fr_method_index.html
|
44
|
+
- doc/fr_class_index.html
|
45
|
+
- doc/fr_file_index.html
|
46
|
+
- doc/created.rid
|
47
|
+
- doc/classes
|
38
48
|
- lib/quicktest.rb
|
49
|
+
- pkg/quicktest-0.3.2.gem
|
39
50
|
- test/test.rb
|
40
51
|
- test/test_result.txt
|
41
52
|
- README
|