lemon 0.8.5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{lemon.gemspec → .gemspec} +0 -0
- data/.ruby +4 -11
- data/Assembly +5 -11
- data/HISTORY.rdoc +31 -0
- data/MANIFEST +45 -55
- data/PROFILE +6 -6
- data/README.md +113 -0
- data/Rakefile +12 -3
- data/VERSION +1 -1
- data/bin/lemonade +8 -0
- data/lib/lemon.rb +52 -2
- data/lib/lemon.yml +4 -11
- data/lib/lemon/{model/ae.rb → ae.rb} +0 -0
- data/lib/lemon/cli.rb +28 -279
- data/lib/lemon/cli/base.rb +139 -0
- data/lib/lemon/cli/coverage.rb +52 -0
- data/lib/lemon/cli/generate.rb +51 -0
- data/lib/lemon/cli/test.rb +50 -0
- data/lib/lemon/core_ext.rb +7 -0
- data/lib/lemon/core_ext/kernel.rb +20 -0
- data/lib/lemon/core_ext/omission.rb +18 -0
- data/lib/lemon/{controller/coverage_analyzer.rb → coverage/analyzer.rb} +41 -19
- data/lib/lemon/{model → coverage}/cover_unit.rb +0 -0
- data/lib/lemon/{view/cover_reports → coverage/formats}/abstract.rb +0 -0
- data/lib/lemon/{view/cover_reports → coverage/formats}/compact.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/outline.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/verbose.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/yaml.rb +1 -1
- data/lib/lemon/{model → coverage}/snapshot.rb +0 -0
- data/lib/lemon/{model → coverage}/source_parser.rb +0 -0
- data/lib/lemon/{controller/scaffold_generator.rb → generator.rb} +53 -14
- data/lib/lemon/test_advice.rb +63 -0
- data/lib/lemon/test_case.rb +270 -0
- data/lib/lemon/test_class.rb +28 -0
- data/lib/lemon/test_method.rb +207 -0
- data/lib/lemon/test_module.rb +114 -0
- data/lib/lemon/test_proc.rb +140 -0
- data/lib/lemon/test_setup.rb +54 -0
- data/lib/lemon/test_world.rb +9 -0
- data/notes/{2010-05-06-files_not_classes.rdoc → 2010-05-06-files-not-classes.rdoc} +0 -0
- data/notes/{2010-07-11-acid_testing.rdoc → 2010-07-11-acid-testing.rdoc} +0 -0
- data/notes/2011-07-07-nailing-down-the-nomenclature.md +6 -0
- data/site/index.html +7 -6
- data/{qed → spec}/applique/fs.rb +0 -0
- data/{qed → spec}/coverage/01_complete.rdoc +26 -16
- data/{qed → spec}/coverage/02_incomplete.rdoc +10 -7
- data/{qed → spec}/coverage/03_extensions.rdoc +10 -6
- data/spec/coverage/applique/lemon.rb +1 -0
- data/try/.test +8 -0
- data/try/case_error.rb +18 -0
- data/try/case_fail.rb +19 -0
- data/try/case_pass.rb +42 -0
- data/try/case_pending.rb +18 -0
- data/try/case_singleton.rb +18 -0
- data/try/case_untested.rb +14 -0
- data/try/fixtures/calculator.rb +15 -0
- data/{demo/fixture → try/fixtures}/example-use.rb +0 -0
- data/{demo/fixture → try/fixtures}/example.rb +0 -0
- data/try/helpers/loadpath.rb +1 -0
- data/{.config → work/deprecated}/cucumber.yml +0 -0
- data/{features → work/deprecated/features}/coverage.feature +0 -0
- data/{features → work/deprecated/features}/generate.feature +0 -0
- data/{features → work/deprecated/features}/step_definitions/coverage_steps.rb +0 -0
- data/{features → work/deprecated/features}/support/ae.rb +0 -0
- data/{features → work/deprecated/features}/support/aruba.rb +0 -0
- data/{features → work/deprecated/features}/test.feature +0 -0
- data/work/deprecated/model/dsl/advice.rb +78 -0
- data/work/deprecated/model/dsl/subject.rb +40 -0
- data/{lib/lemon → work/deprecated}/model/main.rb +40 -29
- data/work/deprecated/model/test.rb +54 -0
- data/work/deprecated/model/test_base_dsl.rb +88 -0
- data/work/deprecated/model/test_clause.rb +112 -0
- data/{lib/lemon → work/deprecated}/model/test_context.rb +24 -24
- data/work/deprecated/model/test_feature.rb +128 -0
- data/work/deprecated/model/test_scenario.rb +137 -0
- data/{lib/lemon → work/deprecated}/model/test_suite.rb +113 -32
- data/work/deprecated/rake.rb +103 -0
- data/{test → work/deprecated/test}/case_coverage_analyzer.rb +0 -0
- data/{test → work/deprecated/test}/case_test_case_dsl.rb +2 -2
- data/{test → work/deprecated/test}/fixtures/case_complete.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/case_inclusion.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/case_incomplete.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/example.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/helper.rb +0 -0
- data/{test → work/deprecated/test}/runner +0 -0
- data/work/old-tests/case_example.rb +15 -0
- data/work/old-tests/feature_example.rb +40 -0
- data/work/reference/dsl2.rb +4 -0
- metadata +101 -98
- data/README.rdoc +0 -103
- data/bin/lemon +0 -4
- data/demo/case_example_error.rb +0 -10
- data/demo/case_example_fail.rb +0 -15
- data/demo/case_example_pass.rb +0 -32
- data/demo/case_example_pending.rb +0 -14
- data/demo/case_example_untested.rb +0 -10
- data/lib/lemon/controller/test_runner.rb +0 -299
- data/lib/lemon/model/pending.rb +0 -10
- data/lib/lemon/model/test_case.rb +0 -305
- data/lib/lemon/model/test_unit.rb +0 -147
- data/lib/lemon/view/test_reports/abstract.rb +0 -256
- data/lib/lemon/view/test_reports/dotprogress.rb +0 -73
- data/lib/lemon/view/test_reports/html.rb +0 -146
- data/lib/lemon/view/test_reports/outline.rb +0 -118
- data/lib/lemon/view/test_reports/summary.rb +0 -131
- data/lib/lemon/view/test_reports/tap.rb +0 -49
- data/lib/lemon/view/test_reports/tapj.rb +0 -130
- data/lib/lemon/view/test_reports/tapy.rb +0 -141
- data/lib/lemon/view/test_reports/verbose.rb +0 -197
- data/work/sandbox/lib/sample.rb +0 -13
- data/work/sandbox/test/sample_case.rb +0 -12
- data/work/trash/example-cover.rb +0 -5
- data/work/trash/example.rb +0 -16
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
module Lemon::TestReports
|
|
2
|
-
|
|
3
|
-
# Test Reporter Base Class
|
|
4
|
-
class Abstract
|
|
5
|
-
|
|
6
|
-
require 'ansi/core'
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
def self.inherited(base)
|
|
10
|
-
registry << base
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
def self.registry
|
|
15
|
-
@registry ||= []
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
def initialize(runner)
|
|
20
|
-
@runner = runner
|
|
21
|
-
@source = {}
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
attr :runner
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
def start_suite(suite)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
def start_case(instance)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
#def instance(instance)
|
|
37
|
-
#end
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
def start_unit(unit)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Report an omitted unit test.
|
|
44
|
-
def omit(unit)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
#
|
|
48
|
-
def pass(unit)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
def fail(unit, exception)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
#
|
|
56
|
-
def error(unit, exception)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
#
|
|
60
|
-
def finish_unit(testunit)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
#
|
|
64
|
-
def finish_case(instance)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
#
|
|
68
|
-
def finish_suite(suite)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
private
|
|
72
|
-
|
|
73
|
-
def record ; runner.record ; end
|
|
74
|
-
|
|
75
|
-
# Is coverage information requested?
|
|
76
|
-
#def cover? ; runner.cover? ; end
|
|
77
|
-
|
|
78
|
-
#
|
|
79
|
-
def total
|
|
80
|
-
%w{pending pass fail error omit}.inject(0){ |s,r| s += record[r.to_sym].size; s }
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
#
|
|
84
|
-
def tally
|
|
85
|
-
sizes = %w{pending fail error omit pass}.map{ |r| record[r.to_sym].size }
|
|
86
|
-
data = [total] + sizes
|
|
87
|
-
s = "%s tests: %s pending, %s fail, %s err, %s omit, %s pass " % data
|
|
88
|
-
#s += "(#{uncovered_units.size} uncovered, #{undefined_units.size} undefined)" if cover?
|
|
89
|
-
s
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
#FILE_SEPARATOR = Regexp.escape(File::SEPARATOR)
|
|
93
|
-
|
|
94
|
-
#
|
|
95
|
-
INTERNALS = /(lib|bin)[\\\/]lemon/
|
|
96
|
-
|
|
97
|
-
# Clean the backtrace of any reference to ko/ paths and code.
|
|
98
|
-
def clean_backtrace(backtrace)
|
|
99
|
-
trace = backtrace.reject{ |bt| bt =~ INTERNALS }
|
|
100
|
-
trace.map do |bt|
|
|
101
|
-
if i = bt.index(':in')
|
|
102
|
-
bt[0...i]
|
|
103
|
-
else
|
|
104
|
-
bt
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# Have to thank Suraj N. Kurapati for the crux of this code.
|
|
110
|
-
def code_snippet(exception, bredth=3)
|
|
111
|
-
backtrace = exception.backtrace.reject{ |bt| bt =~ INTERNALS }
|
|
112
|
-
backtrace.first =~ /(.+?):(\d+(?=:|\z))/ or return ""
|
|
113
|
-
source_file, source_line = $1, $2.to_i
|
|
114
|
-
|
|
115
|
-
source = source(source_file)
|
|
116
|
-
|
|
117
|
-
radius = bredth # number of surrounding lines to show
|
|
118
|
-
region = [source_line - radius, 1].max ..
|
|
119
|
-
[source_line + radius, source.length].min
|
|
120
|
-
|
|
121
|
-
# ensure proper alignment by zero-padding line numbers
|
|
122
|
-
format = " %2s %0#{region.last.to_s.length}d %s"
|
|
123
|
-
|
|
124
|
-
pretty = region.map do |n|
|
|
125
|
-
format % [('=>' if n == source_line), n, source[n-1].chomp]
|
|
126
|
-
end #.unshift "[#{region.inspect}] in #{source_file}"
|
|
127
|
-
|
|
128
|
-
pretty
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
=begin
|
|
132
|
-
#
|
|
133
|
-
def code_snippet_hash(exception, bredth=3)
|
|
134
|
-
backtrace = filtered_backtrace(exception)
|
|
135
|
-
|
|
136
|
-
backtrace.first =~ /(.+?):(\d+(?=:|\z))/ or return ""
|
|
137
|
-
source_file, source_line = $1, $2.to_i
|
|
138
|
-
|
|
139
|
-
source = source(source_file)
|
|
140
|
-
|
|
141
|
-
radius = bredth # number of surrounding lines to show
|
|
142
|
-
region = [source_line - radius, 1].max ..
|
|
143
|
-
[source_line + radius, source.length].min
|
|
144
|
-
|
|
145
|
-
# ensure proper alignment by zero-padding line numbers
|
|
146
|
-
format = " %2s %0#{region.last.to_s.length}d %s"
|
|
147
|
-
|
|
148
|
-
hash = {}
|
|
149
|
-
region.each do |n|
|
|
150
|
-
hash[n] = source[n-1].chomp
|
|
151
|
-
end
|
|
152
|
-
hash
|
|
153
|
-
end
|
|
154
|
-
=end
|
|
155
|
-
|
|
156
|
-
#
|
|
157
|
-
def code_snippet_array(exception, bredth=3)
|
|
158
|
-
backtrace = filtered_backtrace(exception)
|
|
159
|
-
backtrace.first =~ /(.+?):(\d+(?=:|\z))/ or return ""
|
|
160
|
-
source_file, source_line = $1, $2.to_i
|
|
161
|
-
|
|
162
|
-
source = source(source_file)
|
|
163
|
-
|
|
164
|
-
radius = bredth # number of surrounding lines to show
|
|
165
|
-
region = [source_line - radius, 1].max ..
|
|
166
|
-
[source_line + radius, source.length].min
|
|
167
|
-
|
|
168
|
-
# ensure proper alignment by zero-padding line numbers
|
|
169
|
-
#format = " %2s %0#{region.last.to_s.length}d %s"
|
|
170
|
-
|
|
171
|
-
region.map do |n|
|
|
172
|
-
source[n-1].chomp
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
#
|
|
177
|
-
def code_snippet_omap(exception, bredth=3)
|
|
178
|
-
backtrace = filtered_backtrace(exception)
|
|
179
|
-
backtrace.first =~ /(.+?):(\d+(?=:|\z))/ or return ""
|
|
180
|
-
source_file, source_line = $1, $2.to_i
|
|
181
|
-
|
|
182
|
-
source = source(source_file)
|
|
183
|
-
|
|
184
|
-
radius = bredth # number of surrounding lines to show
|
|
185
|
-
region = [source_line - radius, 1].max ..
|
|
186
|
-
[source_line + radius, source.length].min
|
|
187
|
-
|
|
188
|
-
# ensure proper alignment by zero-padding line numbers
|
|
189
|
-
#format = " %2s %0#{region.last.to_s.length}d %s"
|
|
190
|
-
|
|
191
|
-
a = []
|
|
192
|
-
region.each do |n|
|
|
193
|
-
a << {n=> source[n-1].chomp}
|
|
194
|
-
end
|
|
195
|
-
a
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
# TODO: improve
|
|
199
|
-
def code_line(exception)
|
|
200
|
-
code_snippet_array(exception, 0).first.strip
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
#
|
|
204
|
-
def source(file)
|
|
205
|
-
@source[file] ||= (
|
|
206
|
-
File.readlines(file)
|
|
207
|
-
)
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
# TODO: Show more of the file name than just the basename.
|
|
211
|
-
def file_and_line(exception)
|
|
212
|
-
line = exception.backtrace[0]
|
|
213
|
-
return "" unless line
|
|
214
|
-
i = line.rindex(':in')
|
|
215
|
-
line = i ? line[0...i] : line
|
|
216
|
-
File.basename(line)
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
#
|
|
220
|
-
def file_and_line_array(exception)
|
|
221
|
-
case exception
|
|
222
|
-
when Exception
|
|
223
|
-
line = exception.backtrace[0]
|
|
224
|
-
else
|
|
225
|
-
line = exception[0] # backtrace
|
|
226
|
-
end
|
|
227
|
-
return ["", 0] unless line
|
|
228
|
-
i = line.rindex(':in')
|
|
229
|
-
line = i ? line[0...i] : line
|
|
230
|
-
f, l = File.basename(line).split(':')
|
|
231
|
-
return [f, l.to_i]
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
def file(exception)
|
|
236
|
-
file_and_line_array(exception).first
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
def line(exception)
|
|
240
|
-
file_and_line_array(exception).last
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
#
|
|
244
|
-
def filtered_backtrace(exception)
|
|
245
|
-
case exception
|
|
246
|
-
when Exception
|
|
247
|
-
backtrace = exception.backtrace
|
|
248
|
-
else
|
|
249
|
-
backtrace = exception
|
|
250
|
-
end
|
|
251
|
-
backtrace.reject{ |bt| bt =~ INTERNALS }
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
require 'lemon/view/test_reports/abstract'
|
|
2
|
-
|
|
3
|
-
module Lemon::TestReports
|
|
4
|
-
|
|
5
|
-
# Simple Dot-Progress Reporter
|
|
6
|
-
class Dotprogress < Abstract
|
|
7
|
-
|
|
8
|
-
def omit(unit)
|
|
9
|
-
print "O"; $stdout.flush
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def pass(unit)
|
|
13
|
-
print "."; $stdout.flush
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def fail(unit, exception)
|
|
17
|
-
print "F"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def error(unit, exception)
|
|
21
|
-
print "E"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def pending(unit, exception)
|
|
25
|
-
print "P"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def finish_suite(suite)
|
|
29
|
-
puts; puts
|
|
30
|
-
|
|
31
|
-
## if verbose
|
|
32
|
-
unless record[:omit].empty?
|
|
33
|
-
puts "OMITTED:\n\n"
|
|
34
|
-
puts record[:omit].map{ |u| u.to_s }.sort.join(' ')
|
|
35
|
-
puts
|
|
36
|
-
end
|
|
37
|
-
## end
|
|
38
|
-
|
|
39
|
-
unless record[:pending].empty?
|
|
40
|
-
puts "PENDING:\n\n"
|
|
41
|
-
record[:pending].each do |testunit, exception|
|
|
42
|
-
puts " #{testunit}"
|
|
43
|
-
end
|
|
44
|
-
puts
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
unless record[:fail].empty?
|
|
48
|
-
puts "FAILURES:\n\n"
|
|
49
|
-
record[:fail].each do |testunit, exception|
|
|
50
|
-
puts " #{testunit}"
|
|
51
|
-
puts " #{exception}"
|
|
52
|
-
puts " #{exception.backtrace[0]}"
|
|
53
|
-
puts
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
unless record[:error].empty?
|
|
58
|
-
puts "ERRORS:\n\n"
|
|
59
|
-
record[:error].each do |testunit, exception|
|
|
60
|
-
puts " #{testunit}"
|
|
61
|
-
puts " #{exception}"
|
|
62
|
-
puts " #{exception.backtrace[0]}"
|
|
63
|
-
puts
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
puts tally
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
require 'lemon/view/test_reports/abstract'
|
|
2
|
-
|
|
3
|
-
module Lemon::TestReports
|
|
4
|
-
|
|
5
|
-
# HTML Test Reporter
|
|
6
|
-
#
|
|
7
|
-
# TODO: Make this more like a microformat and add timer info.
|
|
8
|
-
class Html < Abstract
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
def start_suite(suite)
|
|
12
|
-
timer_reset
|
|
13
|
-
@html = []
|
|
14
|
-
@html << %[<html>]
|
|
15
|
-
@html << %[<head>]
|
|
16
|
-
@html << %[<title>Unit Test Report</title>]
|
|
17
|
-
@html << %[ <style>]
|
|
18
|
-
@html << %[ html{ background: #fff; margin: 0; padding: 0; font-family: helvetica; }]
|
|
19
|
-
@html << %[ body{ margin: 0; padding: 0;}]
|
|
20
|
-
@html << %[ h3{color:#555;}]
|
|
21
|
-
@html << %[ #main{ margin: 0 auto; color: #110; width: 600px; ]
|
|
22
|
-
@html << %[ border-right: 1px solid #ddd; border-left: 1px solid #ddd; ]
|
|
23
|
-
@html << %[ padding: 10px 30px; width: 500px; } ]
|
|
24
|
-
@html << %[ .lemon{ color: gold; font-size: 22px; font-weight: bold; ]
|
|
25
|
-
@html << %[ font-family: courier; margin-bottom: -15px;}]
|
|
26
|
-
@html << %[ .tally{ font-weight: bold; margin-bottom: 10px; }]
|
|
27
|
-
@html << %[ .omit{ color: cyan; }]
|
|
28
|
-
@html << %[ .pass{ color: green; }]
|
|
29
|
-
@html << %[ .fail{ color: red; }]
|
|
30
|
-
@html << %[ .footer{ font-size: 0.7em; color: #666; margin: 20px 0; }]
|
|
31
|
-
@html << %[ </style>]
|
|
32
|
-
@html << %[</head>]
|
|
33
|
-
@html << %[<body>]
|
|
34
|
-
@html << %[<div id="main">]
|
|
35
|
-
@html << %[<div class="lemon">L E M O N</div>]
|
|
36
|
-
@html << %[<h1>Unit Test Report</h1>]
|
|
37
|
-
@body = []
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
def start_case(tc)
|
|
42
|
-
@body << "<h2>"
|
|
43
|
-
@body << tc.to_s
|
|
44
|
-
@body << "</h2>"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
#
|
|
48
|
-
def instance(instance)
|
|
49
|
-
@body << "<h3>"
|
|
50
|
-
@body << "#{instance}"
|
|
51
|
-
@body << "</h3>"
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
#
|
|
55
|
-
def start_unit(unit)
|
|
56
|
-
instance = unit.instance
|
|
57
|
-
if @instance != instance
|
|
58
|
-
@instance = instance
|
|
59
|
-
instance(instance)
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
#
|
|
64
|
-
def omit(unit)
|
|
65
|
-
@body << %[<li class="omit">]
|
|
66
|
-
@body << " %s %s %s" % ["OMIT", unit.name, unit.aspect]
|
|
67
|
-
@body << %[</li>]
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
#
|
|
71
|
-
def pass(unit)
|
|
72
|
-
@body << %[<li class="pass">]
|
|
73
|
-
@body << "%s %s %s" % ["PASS", unit.name, unit.aspect]
|
|
74
|
-
@body << %[</li>]
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
#
|
|
78
|
-
def fail(unit, exception)
|
|
79
|
-
@body << %[<li class="fail">]
|
|
80
|
-
@body << "%s %s %s" % ["FAIL", unit.name, unit.aspect]
|
|
81
|
-
@body << "<pre>"
|
|
82
|
-
@body << " FAIL #{exception.backtrace[0]}"
|
|
83
|
-
@body << " #{exception}"
|
|
84
|
-
@body << "</pre>"
|
|
85
|
-
@body << %[</li>]
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
def error(unit, exception)
|
|
90
|
-
@body << %[<li class="error">]
|
|
91
|
-
@body << "%s %s %s" % ["ERROR", unit.name, unit.aspect]
|
|
92
|
-
@body << "<pre>"
|
|
93
|
-
@body << " ERROR #{exception.class}"
|
|
94
|
-
@body << " #{exception}"
|
|
95
|
-
@body << " " + exception.backtrace.join("\n ")
|
|
96
|
-
@body << "</pre>"
|
|
97
|
-
@body << %[</li>]
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
#
|
|
101
|
-
def pending(unit, exception)
|
|
102
|
-
@body << %[<li class="pending">]
|
|
103
|
-
@body << " %s %s %s" % ["PENDING", unit.name, unit.aspect]
|
|
104
|
-
@body << %[</li>]
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
def finish_suite(suite)
|
|
109
|
-
@html << ""
|
|
110
|
-
@html << %[<div class="tally">]
|
|
111
|
-
@html << tally
|
|
112
|
-
@html << %[</div>]
|
|
113
|
-
@html << ""
|
|
114
|
-
|
|
115
|
-
@body << ""
|
|
116
|
-
@body << %[<div class="footer">]
|
|
117
|
-
@body << %[Generated by <a href="http://proutils.github.com/lemon">Lemon</a>]
|
|
118
|
-
@body << %[on #{Time.now}.]
|
|
119
|
-
@body << %[</div>]
|
|
120
|
-
@body << ""
|
|
121
|
-
@body << %[</div>]
|
|
122
|
-
@body << %[</div>]
|
|
123
|
-
@body << ""
|
|
124
|
-
@body << %[</body>]
|
|
125
|
-
@body << %[</html>]
|
|
126
|
-
|
|
127
|
-
puts @html.join("\n")
|
|
128
|
-
puts @body.join("\n")
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
#
|
|
132
|
-
def timer
|
|
133
|
-
secs = Time.now - @time
|
|
134
|
-
@time = Time.now
|
|
135
|
-
return "%0.5fs" % [secs.to_s]
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
#
|
|
139
|
-
def timer_reset
|
|
140
|
-
@time = Time.now
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
end
|
|
146
|
-
|