turn 0.7.0 → 0.8.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/History.txt +8 -0
- data/README.txt +4 -8
- data/Rakefile +13 -4
- data/Release.txt +30 -47
- data/Version.txt +1 -0
- data/bin/turn +2 -2
- data/demo/test_autorun_minitest.rb +26 -0
- data/demo/test_autorun_testunit.rb +26 -0
- data/demo/test_sample.rb +35 -0
- data/lib/turn/autorun/minitest.rb +155 -0
- data/lib/turn/autorun/testunit.rb +102 -0
- data/lib/turn/bin.rb +4 -0
- data/lib/turn/colorize.rb +44 -8
- data/lib/turn/command.rb +192 -147
- data/lib/turn/components/case.rb +7 -1
- data/lib/turn/components/method.rb +18 -8
- data/lib/turn/components/suite.rb +16 -13
- data/lib/turn/controller.rb +69 -16
- data/lib/turn/core_ext.rb +31 -0
- data/lib/turn/reporter.rb +19 -6
- data/lib/turn/reporters/cue_reporter.rb +167 -0
- data/lib/turn/reporters/dot_reporter.rb +27 -12
- data/lib/turn/reporters/marshal_reporter.rb +1 -48
- data/lib/turn/reporters/outline_reporter.rb +70 -12
- data/lib/turn/reporters/pretty_reporter.rb +184 -0
- data/lib/turn/reporters/progress_reporter.rb +2 -3
- data/lib/turn/runners/crossrunner.rb +8 -6
- data/lib/turn/runners/isorunner.rb +38 -11
- data/lib/turn/runners/minirunner.rb +189 -0
- data/lib/turn/runners/testrunner.rb +23 -16
- data/lib/turn.rb +15 -98
- data/test/helper.rb +97 -0
- data/test/runner +2 -0
- data/test/test_framework.rb +131 -0
- data/test/test_reporters.rb +44 -0
- data/test/test_runners.rb +45 -0
- metadata +70 -37
- data/.meta/package +0 -1
- data/.meta/ruby +0 -1
- data/.meta/version +0 -1
- data/test/test_example.rb +0 -15
- data/test/test_sample.rb +0 -15
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'turn/reporter'
|
2
|
+
|
3
|
+
module Turn
|
4
|
+
|
5
|
+
# = Cue Reporter
|
6
|
+
#
|
7
|
+
# Inspired by Shindo.
|
8
|
+
#
|
9
|
+
class CueReporter < Reporter
|
10
|
+
|
11
|
+
def start_suite(suite)
|
12
|
+
@suite = suite
|
13
|
+
@time = Time.now
|
14
|
+
@stdout = StringIO.new
|
15
|
+
@stderr = StringIO.new
|
16
|
+
#files = suite.collect{ |s| s.file }.join(' ')
|
17
|
+
io.puts "Loaded suite #{suite.name}"
|
18
|
+
#io.puts "Started"
|
19
|
+
end
|
20
|
+
|
21
|
+
def start_case(kase)
|
22
|
+
io.puts(kase.name)
|
23
|
+
end
|
24
|
+
|
25
|
+
def start_test(test)
|
26
|
+
#if @file != test.file
|
27
|
+
# @file = test.file
|
28
|
+
# io.puts(test.file)
|
29
|
+
#end
|
30
|
+
io.print Colorize.blue(" %-69s" % test.name)
|
31
|
+
$stdout = @stdout
|
32
|
+
$stderr = @stderr
|
33
|
+
$stdout.rewind
|
34
|
+
$stderr.rewind
|
35
|
+
end
|
36
|
+
|
37
|
+
def pass(message=nil)
|
38
|
+
io.puts " #{PASS}"
|
39
|
+
if message
|
40
|
+
message = Colorize.green(message)
|
41
|
+
message = message.to_s.tabto(8)
|
42
|
+
io.puts(message)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def fail(assertion, message=nil)
|
47
|
+
io.puts(" #{FAIL}")
|
48
|
+
#message = assertion.location[0] + "\n" + assertion.message #.gsub("\n","\n")
|
49
|
+
message = message || assertion.to_s
|
50
|
+
#if message
|
51
|
+
message = Colorize.red(message)
|
52
|
+
message = message.to_s.tabto(8)
|
53
|
+
io.puts(message)
|
54
|
+
#end
|
55
|
+
|
56
|
+
show_captured_output
|
57
|
+
|
58
|
+
prompt
|
59
|
+
end
|
60
|
+
|
61
|
+
def error(exception, message=nil)
|
62
|
+
#message = exception.to_s.split("\n")[2..-1].join("\n")
|
63
|
+
message = message || exception.to_s
|
64
|
+
io.puts("#{ERROR}")
|
65
|
+
io.puts(message) #if message
|
66
|
+
|
67
|
+
prompt
|
68
|
+
end
|
69
|
+
|
70
|
+
def finish_test(test)
|
71
|
+
$stdout = STDOUT
|
72
|
+
$stderr = STDERR
|
73
|
+
end
|
74
|
+
|
75
|
+
def show_captured_output
|
76
|
+
show_captured_stdout
|
77
|
+
show_captured_stderr
|
78
|
+
end
|
79
|
+
|
80
|
+
def show_captured_stdout
|
81
|
+
@stdout.rewind
|
82
|
+
return if @stdout.eof?
|
83
|
+
STDOUT.puts(<<-output.tabto(8))
|
84
|
+
\nSTDOUT:
|
85
|
+
#{@stdout.read}
|
86
|
+
output
|
87
|
+
end
|
88
|
+
|
89
|
+
def show_captured_stderr
|
90
|
+
@stderr.rewind
|
91
|
+
return if @stderr.eof?
|
92
|
+
STDOUT.puts(<<-output.tabto(8))
|
93
|
+
\nSTDERR:
|
94
|
+
#{@stderr.read}
|
95
|
+
output
|
96
|
+
end
|
97
|
+
|
98
|
+
#def finish_case(kase)
|
99
|
+
#end
|
100
|
+
|
101
|
+
def finish_suite(suite)
|
102
|
+
total = suite.count_tests
|
103
|
+
failure = suite.count_failures
|
104
|
+
error = suite.count_errors
|
105
|
+
pass = total - failure - error
|
106
|
+
|
107
|
+
bar = '=' * 78
|
108
|
+
if COLORIZE
|
109
|
+
bar = if pass == total then Colorize.green(bar)
|
110
|
+
else Colorize.red(bar) end
|
111
|
+
end
|
112
|
+
|
113
|
+
tally = [total, suite.count_assertions]
|
114
|
+
|
115
|
+
io.puts bar
|
116
|
+
io.puts " pass: %d, fail: %d, error: %d" % [pass, failure, error]
|
117
|
+
io.puts " total: %d tests with %d assertions in #{Time.new - @time} seconds" % tally
|
118
|
+
io.puts bar
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
def prompt
|
124
|
+
begin
|
125
|
+
io << " [c,i,q,r,t,#,?] "
|
126
|
+
io.flush
|
127
|
+
until inp = $stdin.gets ; sleep 1 ; end
|
128
|
+
answer = inp.strip
|
129
|
+
case answer
|
130
|
+
when 'c', ''
|
131
|
+
when 'r'
|
132
|
+
# how to reload and start over?
|
133
|
+
when 'i'
|
134
|
+
# how to drop into an interactive console?
|
135
|
+
when 't'
|
136
|
+
io.puts $@
|
137
|
+
raise ArgumentError
|
138
|
+
when /^\d+$/
|
139
|
+
io.puts $@[0..answer.to_i]
|
140
|
+
raise ArgumentError
|
141
|
+
when 'q'
|
142
|
+
exit -1
|
143
|
+
when '?'
|
144
|
+
io.puts HELP
|
145
|
+
raise ArgumentError #prompt
|
146
|
+
else
|
147
|
+
raise ArgumentError
|
148
|
+
end
|
149
|
+
rescue ArgumentError
|
150
|
+
retry
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
HELP = %{
|
155
|
+
c continue
|
156
|
+
r restart
|
157
|
+
i irb
|
158
|
+
t backtrace
|
159
|
+
# backtrace lines
|
160
|
+
q quit
|
161
|
+
? help
|
162
|
+
}
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
@@ -19,15 +19,15 @@ module Turn
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def pass(message=nil)
|
22
|
-
io.print '.'; io.flush
|
22
|
+
io.print Colorize.pass('.'); io.flush
|
23
23
|
end
|
24
24
|
|
25
25
|
def fail(message=nil)
|
26
|
-
io.print 'F'; io.flush
|
26
|
+
io.print Colorize.fail('F'); io.flush
|
27
27
|
end
|
28
28
|
|
29
29
|
def error(message=nil)
|
30
|
-
io.print 'E'; io.flush
|
30
|
+
io.print Colorize.error('E'); io.flush
|
31
31
|
end
|
32
32
|
|
33
33
|
def finish_test(test)
|
@@ -38,27 +38,42 @@ module Turn
|
|
38
38
|
|
39
39
|
def finish_suite(suite)
|
40
40
|
io.puts("\nFinished in %.5f seconds." % [Time.now - @time])
|
41
|
-
io.puts
|
42
41
|
|
43
42
|
report = ''
|
44
43
|
|
45
|
-
|
46
|
-
|
44
|
+
list = []
|
45
|
+
suite.each do |testcase|
|
46
|
+
testcase.each do |testunit|
|
47
|
+
if testunit.fail? || testunit.error?
|
48
|
+
list << testunit
|
49
|
+
end
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
|
-
unless
|
53
|
+
unless list.empty? # or verbose?
|
50
54
|
#report << "\n\n-- Failures and Errors --\n\n"
|
51
|
-
|
52
|
-
message =
|
53
|
-
message =
|
54
|
-
|
55
|
+
list.uniq.each do |testunit|
|
56
|
+
message = testunit.fail? ? ' '+FAIL : ERROR
|
57
|
+
message = message + ' ' + testunit.message.tabto(0)
|
58
|
+
message << "\n" + filter_backtrace(testunit.backtrace).first
|
59
|
+
report << "\n" << message << "\n"
|
55
60
|
end
|
56
61
|
report << "\n"
|
57
62
|
end
|
58
63
|
|
59
64
|
io.puts report
|
60
65
|
|
61
|
-
|
66
|
+
count = test_tally(suite)
|
67
|
+
|
68
|
+
tally = "%s tests, %s assertions, %s failures, %s errors" % count
|
69
|
+
|
70
|
+
if count[-1] > 0 or count[-2] > 0
|
71
|
+
tally = Colorize.red(tally)
|
72
|
+
else
|
73
|
+
tally = Colorize.green(tally)
|
74
|
+
end
|
75
|
+
|
76
|
+
io.puts tally
|
62
77
|
end
|
63
78
|
|
64
79
|
private
|
@@ -1,59 +1,12 @@
|
|
1
|
+
require 'turn/reporter'
|
1
2
|
require 'yaml'
|
2
3
|
|
3
4
|
module Turn
|
4
|
-
require 'turn/reporter'
|
5
5
|
|
6
6
|
# = Marshal Reporter
|
7
7
|
#
|
8
8
|
class MarshalReporter < Reporter
|
9
9
|
|
10
|
-
#def start_suite(suite)
|
11
|
-
# #@suite = suite
|
12
|
-
# #@time = Time.now
|
13
|
-
# #files = suite.collect{ |s| s.file }.join(' ')
|
14
|
-
# #io.puts "Loaded suite #{suite.name}"
|
15
|
-
# #io.puts "Started"
|
16
|
-
#end
|
17
|
-
|
18
|
-
#def start_test(test)
|
19
|
-
# #if @file != test.file
|
20
|
-
# # @file = test.file
|
21
|
-
# # io.puts(test.file)
|
22
|
-
# #end
|
23
|
-
# io.print " %-69s" % test.name
|
24
|
-
#end
|
25
|
-
|
26
|
-
#def start_case(kase)
|
27
|
-
# io.puts(kase.name)
|
28
|
-
#end
|
29
|
-
|
30
|
-
#def pass(message=nil)
|
31
|
-
# io.puts " #{PASS}"
|
32
|
-
# if message
|
33
|
-
# message = ::ANSI::Code.magenta(message) if COLORIZE
|
34
|
-
# io.puts(message.to_s)
|
35
|
-
# end
|
36
|
-
#end
|
37
|
-
|
38
|
-
#def fail(message=nil)
|
39
|
-
# io.puts(" #{FAIL}")
|
40
|
-
# if message
|
41
|
-
# message = ::ANSI::Code.magenta(message) if COLORIZE
|
42
|
-
# io.puts(message.to_s)
|
43
|
-
# end
|
44
|
-
#end
|
45
|
-
|
46
|
-
#def error(message=nil)
|
47
|
-
# io.puts("#{ERROR}")
|
48
|
-
# io.puts(message.to_s) if message
|
49
|
-
#end
|
50
|
-
|
51
|
-
#def finish_test(test)
|
52
|
-
#end
|
53
|
-
|
54
|
-
#def finish_case(kase)
|
55
|
-
#end
|
56
|
-
|
57
10
|
def finish_suite(suite)
|
58
11
|
$stdout << suite.to_yaml
|
59
12
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'turn/reporter'
|
2
|
+
require 'stringio'
|
2
3
|
|
3
4
|
module Turn
|
4
5
|
|
@@ -10,55 +11,112 @@ module Turn
|
|
10
11
|
#++
|
11
12
|
class OutlineReporter < Reporter
|
12
13
|
|
14
|
+
#
|
13
15
|
def start_suite(suite)
|
14
16
|
@suite = suite
|
15
17
|
@time = Time.now
|
18
|
+
@stdout = StringIO.new
|
19
|
+
@stderr = StringIO.new
|
16
20
|
#files = suite.collect{ |s| s.file }.join(' ')
|
17
|
-
io.puts "
|
21
|
+
io.puts "LOADED SUITE #{suite.name}"
|
18
22
|
#io.puts "Started"
|
19
23
|
end
|
20
24
|
|
25
|
+
#
|
21
26
|
def start_case(kase)
|
22
|
-
io.puts(kase.name)
|
27
|
+
io.puts(Colorize.bold("#{kase.name}"))
|
23
28
|
end
|
24
29
|
|
30
|
+
#
|
25
31
|
def start_test(test)
|
26
32
|
#if @file != test.file
|
27
33
|
# @file = test.file
|
28
34
|
# io.puts(test.file)
|
29
35
|
#end
|
30
36
|
io.print " %-69s" % test.name
|
37
|
+
|
38
|
+
$stdout = @stdout
|
39
|
+
$stderr = @stderr
|
40
|
+
$stdout.rewind
|
41
|
+
$stderr.rewind
|
31
42
|
end
|
32
43
|
|
44
|
+
#
|
33
45
|
def pass(message=nil)
|
34
46
|
io.puts " #{PASS}"
|
35
47
|
if message
|
36
|
-
message =
|
48
|
+
message = Colorize.magenta(message)
|
37
49
|
message = message.to_s.tabto(8)
|
38
50
|
io.puts(message)
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
42
|
-
|
54
|
+
#
|
55
|
+
def fail(assertion)
|
56
|
+
message = assertion.message.to_s
|
57
|
+
backtrace = filter_backtrace(assertion.backtrace)
|
58
|
+
|
43
59
|
io.puts(" #{FAIL}")
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
io.puts(
|
60
|
+
io.puts Colorize.bold(message).tabto(8)
|
61
|
+
unless backtrace.empty?
|
62
|
+
backtrace = "Assertion at " + filter_backtrace(assertion.backtrace).first
|
63
|
+
io.puts "STDERR:".tabto(8)
|
64
|
+
io.puts(backtrace.tabto(8))
|
48
65
|
end
|
66
|
+
show_captured_output
|
49
67
|
end
|
50
68
|
|
51
|
-
|
69
|
+
#
|
70
|
+
def error(exception)
|
71
|
+
message = exception.message
|
72
|
+
backtrace = "Exception `#{exception.class}' at " + filter_backtrace(exception.backtrace).join("\n")
|
73
|
+
message = Colorize.bold(message)
|
52
74
|
io.puts("#{ERROR}")
|
53
|
-
io.puts(message.
|
75
|
+
io.puts(message.tabto(8))
|
76
|
+
io.puts "STDERR:".tabto(8)
|
77
|
+
io.puts(backtrace.tabto(8))
|
78
|
+
show_captured_output
|
54
79
|
end
|
55
80
|
|
81
|
+
#
|
56
82
|
def finish_test(test)
|
83
|
+
$stdout = STDOUT
|
84
|
+
$stderr = STDERR
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
def show_captured_output
|
89
|
+
show_captured_stdout
|
90
|
+
#show_captured_stderr
|
91
|
+
end
|
92
|
+
|
93
|
+
#
|
94
|
+
def show_captured_stdout
|
95
|
+
@stdout.rewind
|
96
|
+
return if @stdout.eof?
|
97
|
+
STDOUT.puts(<<-output.tabto(8))
|
98
|
+
\nSTDOUT:
|
99
|
+
#{@stdout.read}
|
100
|
+
output
|
101
|
+
end
|
102
|
+
|
103
|
+
# No longer used b/c of error messages are fairly extraneous.
|
104
|
+
=begin
|
105
|
+
def show_captured_stderr
|
106
|
+
@stderr.rewind
|
107
|
+
return if @stderr.eof?
|
108
|
+
STDOUT.puts(<<-output.tabto(8))
|
109
|
+
\nSTDERR:
|
110
|
+
#{@stderr.read}
|
111
|
+
output
|
57
112
|
end
|
113
|
+
=end
|
58
114
|
|
115
|
+
#
|
59
116
|
#def finish_case(kase)
|
60
117
|
#end
|
61
118
|
|
119
|
+
#
|
62
120
|
def finish_suite(suite)
|
63
121
|
total = suite.count_tests
|
64
122
|
failure = suite.count_failures
|
@@ -67,8 +125,8 @@ module Turn
|
|
67
125
|
|
68
126
|
bar = '=' * 78
|
69
127
|
if COLORIZE
|
70
|
-
bar = if pass == total then
|
71
|
-
else
|
128
|
+
bar = if pass == total then Colorize.green(bar)
|
129
|
+
else Colorize.red(bar) end
|
72
130
|
end
|
73
131
|
|
74
132
|
tally = [total, suite.count_assertions]
|
@@ -0,0 +1,184 @@
|
|
1
|
+
require 'turn/reporter'
|
2
|
+
|
3
|
+
module Turn
|
4
|
+
|
5
|
+
# = Pretty Reporter (by Paydro)
|
6
|
+
#
|
7
|
+
class PrettyReporter < Reporter
|
8
|
+
#
|
9
|
+
PADDING_SIZE = 4
|
10
|
+
|
11
|
+
#
|
12
|
+
def start_suite(suite)
|
13
|
+
#old_sync, @@out.sync = @@out.sync, true if io.respond_to? :sync=
|
14
|
+
@suite = suite
|
15
|
+
@time = Time.now
|
16
|
+
#@stdout = StringIO.new
|
17
|
+
#@stderr = StringIO.new
|
18
|
+
#files = suite.collect{ |s| s.file }.join(' ')
|
19
|
+
io.puts "Loaded suite #{suite.name}"
|
20
|
+
#io.puts "Loaded suite #{$0.sub(/\.rb$/, '')}\nStarted"
|
21
|
+
io.puts "Started"
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
def start_case(kase)
|
26
|
+
#if kase.size > 0 # TODO: Don't have size yet?
|
27
|
+
io.print "\n#{kase.name}:\n"
|
28
|
+
#end
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
def start_test(test)
|
33
|
+
@test_time = Time.now
|
34
|
+
@test = test
|
35
|
+
#if @file != test.file
|
36
|
+
# @file = test.file
|
37
|
+
# io.puts(test.file)
|
38
|
+
#end
|
39
|
+
#io.print " %-69s" % test.name
|
40
|
+
#$stdout = @stdout
|
41
|
+
#$stderr = @stderr
|
42
|
+
#$stdout.rewind
|
43
|
+
#$stderr.rewind
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
def pass(message=nil)
|
48
|
+
io.print pad_with_size("#{PASS}")
|
49
|
+
io.print " #{@test}"
|
50
|
+
io.print " (%.2fs) " % (Time.now - @test_time)
|
51
|
+
if message
|
52
|
+
message = Colorize.magenta(message)
|
53
|
+
message = message.to_s.tabto(10)
|
54
|
+
io.puts(message)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
def fail(assertion)
|
60
|
+
io.print pad_with_size("#{FAIL}")
|
61
|
+
io.print " #{@test}"
|
62
|
+
io.print " (%.2fs) " % (Time.now - @test_time)
|
63
|
+
|
64
|
+
#message = assertion.location[0] + "\n" + assertion.message #.gsub("\n","\n")
|
65
|
+
#trace = MiniTest::filter_backtrace(report[:exception].backtrace).first
|
66
|
+
|
67
|
+
message = assertion.message
|
68
|
+
|
69
|
+
if assertion.respond_to?(:backtrace)
|
70
|
+
trace = filter_backtrace(assertion.backtrace).first
|
71
|
+
else
|
72
|
+
trace = filter_backtrace(assertion.location).first
|
73
|
+
end
|
74
|
+
|
75
|
+
io.puts
|
76
|
+
#io.puts pad(message, 10)
|
77
|
+
io.puts message.tabto(10)
|
78
|
+
io.puts trace.tabto(10)
|
79
|
+
#show_captured_output
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
def error(exception)
|
84
|
+
io.print pad_with_size("#{ERROR}")
|
85
|
+
io.print " #{@test}"
|
86
|
+
io.print " (%.2fs) " % (Time.now - @test_time)
|
87
|
+
|
88
|
+
#message = exception.to_s.split("\n")[2..-1].join("\n")
|
89
|
+
|
90
|
+
message = exception.message
|
91
|
+
|
92
|
+
if exception.respond_to?(:backtrace)
|
93
|
+
trace = filter_backtrace(exception.backtrace).first
|
94
|
+
else
|
95
|
+
trace = filter_backtrace(exception.location).first
|
96
|
+
end
|
97
|
+
|
98
|
+
io.puts
|
99
|
+
io.puts message.tabto(10)
|
100
|
+
io.puts trace.tabto(10)
|
101
|
+
end
|
102
|
+
|
103
|
+
# TODO: skip support
|
104
|
+
#def skip
|
105
|
+
# io.puts(pad_with_size("#{SKIP}"))
|
106
|
+
#end
|
107
|
+
|
108
|
+
#
|
109
|
+
def finish_test(test)
|
110
|
+
io.puts
|
111
|
+
#@test_count += 1
|
112
|
+
#@assertion_count += inst._assertions
|
113
|
+
#$stdout = STDOUT
|
114
|
+
#$stderr = STDERR
|
115
|
+
end
|
116
|
+
|
117
|
+
=begin
|
118
|
+
def show_captured_output
|
119
|
+
show_captured_stdout
|
120
|
+
show_captured_stderr
|
121
|
+
end
|
122
|
+
|
123
|
+
def show_captured_stdout
|
124
|
+
@stdout.rewind
|
125
|
+
return if @stdout.eof?
|
126
|
+
STDOUT.puts(<<-output.tabto(8))
|
127
|
+
\nSTDOUT:
|
128
|
+
#{@stdout.read}
|
129
|
+
output
|
130
|
+
end
|
131
|
+
|
132
|
+
def show_captured_stderr
|
133
|
+
@stderr.rewind
|
134
|
+
return if @stderr.eof?
|
135
|
+
STDOUT.puts(<<-output.tabto(8))
|
136
|
+
\nSTDERR:
|
137
|
+
#{@stderr.read}
|
138
|
+
output
|
139
|
+
end
|
140
|
+
=end
|
141
|
+
|
142
|
+
def finish_case(kase)
|
143
|
+
if kase.size == 0
|
144
|
+
io.puts pad("(No Tests)")
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
def finish_suite(suite)
|
150
|
+
#@@out.sync = old_sync if @@out.respond_to? :sync=
|
151
|
+
|
152
|
+
total = suite.count_tests
|
153
|
+
failure = suite.count_failures
|
154
|
+
error = suite.count_errors
|
155
|
+
#pass = total - failure - error
|
156
|
+
|
157
|
+
io.puts
|
158
|
+
io.puts "Finished in #{'%.6f' % (Time.now - @time)} seconds."
|
159
|
+
io.puts
|
160
|
+
|
161
|
+
io.print "%d tests, " % total
|
162
|
+
io.print "%d assertions, " % suite.count_assertions
|
163
|
+
io.print Colorize.fail( "%d failures" % failure) + ', '
|
164
|
+
io.print Colorize.error("%d errors" % error) #+ ', '
|
165
|
+
#io.puts Colorize.cyan( "%d skips" % skips ) #TODO
|
166
|
+
io.puts
|
167
|
+
end
|
168
|
+
|
169
|
+
private
|
170
|
+
|
171
|
+
#
|
172
|
+
def pad(str, size=PADDING_SIZE)
|
173
|
+
" " * size + str
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
def pad_with_size(str)
|
178
|
+
" " * (18 - str.size) + str
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'turn/reporter'
|
2
2
|
require 'ansi/progressbar'
|
3
|
-
require 'facets/string/tab'
|
4
3
|
|
5
4
|
module Turn
|
6
5
|
|
@@ -53,7 +52,7 @@ module Turn
|
|
53
52
|
suite.each do |testrun|
|
54
53
|
if testrun.files != [testrun.name] && testrun.files != files
|
55
54
|
label = testrun.files.join(' ')
|
56
|
-
label =
|
55
|
+
label = Colorize.magenta(label)
|
57
56
|
io.puts(label + "\n")
|
58
57
|
files = testrun.files
|
59
58
|
end
|
@@ -77,7 +76,7 @@ module Turn
|
|
77
76
|
io.puts "\n\n-- Failures and Errors --\n\n"
|
78
77
|
fails.uniq.each do |testrun|
|
79
78
|
message = testrun.message.tabto(0).strip
|
80
|
-
message =
|
79
|
+
message = Colorize.red(message)
|
81
80
|
io.puts(message+"\n\n")
|
82
81
|
end
|
83
82
|
io.puts
|
@@ -16,19 +16,21 @@ module Turn
|
|
16
16
|
suite = TestSuite.new
|
17
17
|
|
18
18
|
files = @controller.files
|
19
|
-
viles = @controller.files # TODO:
|
19
|
+
viles = @controller.files # TODO: make selectable ?
|
20
20
|
|
21
21
|
#files = files.select{ |f| File.extname(f) == '.rb' and File.file?(f) }
|
22
22
|
#viles = viles.select{ |f| File.extname(f) == '.rb' and File.file?(f) }
|
23
23
|
|
24
|
-
max = (files+viles).collect{ |f| f.size }.max
|
25
|
-
|
26
24
|
pairs = files.inject([]){ |m, f| viles.collect{ |v| m << [f,v] }; m }
|
27
25
|
pairs = pairs.reject{ |f,v| f == v }
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
max = files.collect{ |f| f.sub(Dir.pwd+'/','').size }.max
|
28
|
+
|
29
|
+
testruns = pairs.collect do |file1, file2|
|
30
|
+
name1 = file1.sub(Dir.pwd+'/','')
|
31
|
+
name2 = file2.sub(Dir.pwd+'/','')
|
32
|
+
name = "%-#{max}s %-#{max}s" % [name1, name2]
|
33
|
+
suite.new_case(name, file1, file2)
|
32
34
|
end
|
33
35
|
|
34
36
|
test_loop_runner(suite)
|