rubytest-progress 0.1.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.
- checksums.yaml +7 -0
- data/.index +48 -0
- data/LICENSE.txt +23 -0
- data/README.md +15 -0
- data/lib/rubytest/format/progress.rb +195 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 271bc8a82b4ca73d3d02180f4071f5fc8da814ed
|
4
|
+
data.tar.gz: 36986c53cf3fe25005fcaff3ec7af5ecccf2ac6b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 384fce8fee6a69e0464375cb021b9932cd440aa432cd281ec23f3f25df1b3417bff6702cc7ecbb567514d7b7f1e0de28fc73d92bb5f8d757124a90a1ab68956b
|
7
|
+
data.tar.gz: e1908533a9a680ebdf0c33841f0f24f40e272b9e7c306e4dfadbb896ff142b097ae0bce91fbb29640f5a55b483ab42df17ac7e5a387bec42e53c08746b765fec
|
data/.index
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
revision: 2013
|
3
|
+
type: ruby
|
4
|
+
sources:
|
5
|
+
- Indexfile
|
6
|
+
- Gemfile
|
7
|
+
authors:
|
8
|
+
- name: trans
|
9
|
+
email: transfire@gmail.com
|
10
|
+
organizations: []
|
11
|
+
requirements:
|
12
|
+
- version: '>= 0.8.0'
|
13
|
+
name: rubytest
|
14
|
+
- version: '>= 0'
|
15
|
+
name: ansi
|
16
|
+
conflicts: []
|
17
|
+
alternatives: []
|
18
|
+
resources:
|
19
|
+
- type: home
|
20
|
+
uri: http://rubyworks.github.com/rubytest-progress
|
21
|
+
label: Homepage
|
22
|
+
- type: code
|
23
|
+
uri: http://github.com/rubyworks/rubytest-progress
|
24
|
+
label: Source Code
|
25
|
+
- type: mail
|
26
|
+
uri: http://groups.google.com/group/rubyworks-mailinglist
|
27
|
+
label: Mailing List
|
28
|
+
repositories:
|
29
|
+
- name: upstream
|
30
|
+
scm: git
|
31
|
+
uri: git@github.com:rubyworks/rubytest-progress.git
|
32
|
+
categories: []
|
33
|
+
copyrights:
|
34
|
+
- holder: RubyWorks
|
35
|
+
year: '2011'
|
36
|
+
license: BSD-2-Clause
|
37
|
+
customs: []
|
38
|
+
paths:
|
39
|
+
lib:
|
40
|
+
- lib
|
41
|
+
name: rubytest-progress
|
42
|
+
title: Progress Report Format
|
43
|
+
version: 0.1.0
|
44
|
+
summary: Progress report format for Rubytest
|
45
|
+
description: This is an progress test report format for the Rubytest metaframework.
|
46
|
+
It produces a progressbar as tests are run.
|
47
|
+
created: '2011-07-23'
|
48
|
+
date: '2014-07-18'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
(BSD-2-Clause License)
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
this list of conditions and the following disclaimer.
|
8
|
+
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
11
|
+
documentation and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
14
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
16
|
+
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
17
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
18
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
19
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
20
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
21
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
22
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23
|
+
|
data/README.md
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module Test::Reporters
|
4
|
+
|
5
|
+
# Progess reporter gives test counter, precentage and times.
|
6
|
+
#
|
7
|
+
class Progress < Abstract
|
8
|
+
|
9
|
+
#
|
10
|
+
def begin_suite(suite)
|
11
|
+
@tab = 0
|
12
|
+
@total_count = total_count(suite)
|
13
|
+
@start_time = Time.now
|
14
|
+
@test_cache = {}
|
15
|
+
@count = 0
|
16
|
+
|
17
|
+
max = @total_count.to_s.size
|
18
|
+
|
19
|
+
@layout_head = " %3u%% %#{max}s %#{max}s %8s %11s %1s %s"
|
20
|
+
@layout = " %3u%% %#{max}u/%#{max}u %8s %11s %1s %s"
|
21
|
+
|
22
|
+
timer_reset
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
def begin_case(tc)
|
27
|
+
#tabs tc.to_s.ansi(:bold)
|
28
|
+
show_header(' ', tc.to_s)
|
29
|
+
@tab += 2
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
def begin_test(test)
|
34
|
+
if test.respond_to?(:topic) && test.topic
|
35
|
+
topic = test.topic.to_s.rstrip
|
36
|
+
@test_cache[topic] ||= (
|
37
|
+
show_header(' ', topic) unless topic.empty?
|
38
|
+
true
|
39
|
+
)
|
40
|
+
end
|
41
|
+
timer_reset
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
def pass(test)
|
46
|
+
show_line(".", test, :green)
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
def fail(test, exception)
|
51
|
+
show_line("F", test, :red)
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
def error(test, exception)
|
56
|
+
show_line("E", test, :red)
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
def todo(test, exception)
|
61
|
+
show_line("P", test, :yellow)
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
def omit(test, exception)
|
66
|
+
show_line("O", test, :cyan)
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
def end_case(tcase)
|
71
|
+
@tab -= 2
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
def end_suite(suite)
|
76
|
+
puts
|
77
|
+
|
78
|
+
if runner.verbose?
|
79
|
+
unless record[:omit].empty?
|
80
|
+
puts "OMISSIONS:\n\n"
|
81
|
+
record[:omit].reverse_each do |test, exception|
|
82
|
+
s = []
|
83
|
+
s << "#{test}".ansi(:bold)
|
84
|
+
s << "#{file_and_line(exception)}"
|
85
|
+
puts s.join("\n").tabto(4)
|
86
|
+
puts code(exception).to_s.tabto(7)
|
87
|
+
puts
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
unless record[:todo].empty?
|
93
|
+
puts "PENDING:\n\n"
|
94
|
+
record[:todo].reverse_each do |test, exception|
|
95
|
+
s = []
|
96
|
+
s << "#{test}".ansi(:bold)
|
97
|
+
s << "#{file_and_line(exception)}"
|
98
|
+
puts s.join("\n").tabto(4)
|
99
|
+
puts code(exception).to_s.tabto(7)
|
100
|
+
puts
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
unless record[:fail].empty?
|
105
|
+
puts "FAILURES:\n\n"
|
106
|
+
record[:fail].reverse_each do |test, exception|
|
107
|
+
s = []
|
108
|
+
s << "#{test}".ansi(:bold)
|
109
|
+
s << "#{exception}".ansi(:red)
|
110
|
+
s << "#{file_and_line(exception)}"
|
111
|
+
puts s.join("\n").tabto(4)
|
112
|
+
puts code(exception).to_s.tabto(7)
|
113
|
+
#puts " #{exception.backtrace[0]}"
|
114
|
+
puts
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
unless record[:error].empty?
|
119
|
+
puts "ERRORS:\n\n"
|
120
|
+
record[:error].reverse_each do |test, exception|
|
121
|
+
trace = clean_backtrace(exception)[1..-1].map{ |bt| bt.sub(Dir.pwd+'/', '') }
|
122
|
+
s = []
|
123
|
+
s << "#{test}".ansi(:bold)
|
124
|
+
s << "#{exception.class}".ansi(:red)
|
125
|
+
s << "#{exception}".ansi(:red)
|
126
|
+
s << "#{file_and_line(exception)}"
|
127
|
+
puts s.join("\n").tabto(4)
|
128
|
+
puts code(exception).to_s.tabto(7)
|
129
|
+
puts trace.join("\n").tabto(4) unless trace.empty?
|
130
|
+
puts
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
puts
|
135
|
+
puts timestamp
|
136
|
+
puts
|
137
|
+
puts tally
|
138
|
+
end
|
139
|
+
|
140
|
+
private
|
141
|
+
|
142
|
+
#
|
143
|
+
def show_header(status, text)
|
144
|
+
text = text[0..text.index("\n")||-1]
|
145
|
+
data = [prcnt, ' ', ' ', clock, timer, status, (' ' * @tab) + text.to_s]
|
146
|
+
#puts (" " * @tab) + (@layout_head % data)
|
147
|
+
puts (@layout_head % data).ansi(:bold)
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
def show_line(status, test, color)
|
152
|
+
@count += 1
|
153
|
+
data = [prcnt, @count, @total_count, clock, timer, status, (' ' * @tab) + test.to_s]
|
154
|
+
#puts (" " * @tab) + (@layout % data)
|
155
|
+
puts (@layout % data).ansi(color)
|
156
|
+
end
|
157
|
+
|
158
|
+
#
|
159
|
+
def prcnt
|
160
|
+
((@count.to_f / @total_count) * 100).round.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
#
|
164
|
+
def clock
|
165
|
+
secs = Time.now - @start_time
|
166
|
+
m, s = secs.divmod(60)
|
167
|
+
#s, ms = s.divmod(1)
|
168
|
+
#ms = ms * 1000
|
169
|
+
return "%u:%02u" % [m, s]
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
def timer
|
174
|
+
secs = Time.now - @time
|
175
|
+
@time = Time.now
|
176
|
+
return "%0.5fs" % secs
|
177
|
+
end
|
178
|
+
|
179
|
+
#
|
180
|
+
def timer_reset
|
181
|
+
@time = Time.now
|
182
|
+
end
|
183
|
+
|
184
|
+
#
|
185
|
+
def tabs(str=nil)
|
186
|
+
if str
|
187
|
+
puts(str.tabto(@tab))
|
188
|
+
else
|
189
|
+
puts
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubytest-progress
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- trans
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubytest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ansi
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This is an progress test report format for the Rubytest metaframework.
|
42
|
+
It produces a progressbar as tests are run.
|
43
|
+
email:
|
44
|
+
- transfire@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files:
|
48
|
+
- LICENSE.txt
|
49
|
+
- README.md
|
50
|
+
files:
|
51
|
+
- .index
|
52
|
+
- lib/rubytest/format/progress.rb
|
53
|
+
- README.md
|
54
|
+
- LICENSE.txt
|
55
|
+
homepage: http://rubyworks.github.com/rubytest-progress
|
56
|
+
licenses:
|
57
|
+
- BSD-2-Clause
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.0.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Progress report format for Rubytest
|
79
|
+
test_files: []
|
80
|
+
has_rdoc:
|