turn 0.9.3 → 0.9.4
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 -3
- data/Release.txt +21 -1
- data/Version.txt +1 -1
- data/lib/turn/reporter.rb +11 -8
- data/lib/turn/reporters/dot_reporter.rb +2 -2
- data/lib/turn/reporters/pretty_reporter.rb +19 -13
- data/lib/turn/runners/minirunner.rb +1 -1
- data/lib/turn/version.rb +1 -1
- data/test/reporter_test.rb +35 -0
- metadata +11 -9
data/History.txt
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
== 0.9.
|
1
|
+
== 0.9.4 / 2012-03-16
|
2
|
+
* Fix dot reporter to use `.` instead of `S` for passed tests.
|
3
|
+
* Do not filter backtraces of local directory.
|
4
|
+
* Do not colourize zero counts in pretty reporter.
|
5
|
+
|
6
|
+
== 0.9.3 / 2012-02-17
|
2
7
|
* Default to pretty reporter.
|
3
8
|
* Can set reporter via `rpt` environment variable.
|
4
9
|
* Fix backtrace filter.
|
5
10
|
* Fix require warning when using cli.
|
6
|
-
* Add skip counts to reporter tallies. (
|
7
|
-
* Improve Pretty reporter output. (
|
11
|
+
* Add skip counts to reporter tallies. (y8)
|
12
|
+
* Improve Pretty reporter output. (y8)
|
8
13
|
|
9
14
|
== 0.9.2 / 2012-02-08
|
10
15
|
* Fix colorization config issue.
|
data/Release.txt
CHANGED
@@ -1,4 +1,24 @@
|
|
1
|
-
=
|
1
|
+
= Release Notes
|
2
|
+
|
3
|
+
== 0.9.x
|
4
|
+
|
5
|
+
The main departure of the 0.9.x series form older version of Turn,
|
6
|
+
is that the old TestUnit library (1.x series) is no longer supported.
|
7
|
+
Turn is now a MiniTest only library.[1]
|
8
|
+
|
9
|
+
Among other imporvements, the default reporter is now the Pretty reporter
|
10
|
+
instead of the orginal Outline reporter, and MiniTest skips are finally
|
11
|
+
supported.
|
12
|
+
|
13
|
+
Big thanks to y8, Alexey Bondar and others for helpig to get this series
|
14
|
+
up to snuff.
|
15
|
+
|
16
|
+
[1] Note that the old testunit runner is still included in the package
|
17
|
+
if it is needed, but no longer will be actively maintained and it
|
18
|
+
must be directly required to be used.
|
19
|
+
|
20
|
+
|
21
|
+
== 0.8.x
|
2
22
|
|
3
23
|
Version 0.8.0 is a fairly significant release for Turn. This release
|
4
24
|
adds support for Ruby 1.9's Minitest framework. You can even use
|
data/Version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/lib/turn/reporter.rb
CHANGED
@@ -72,12 +72,15 @@ module Turn
|
|
72
72
|
limit_backtrace(filter_backtrace(backtrace))
|
73
73
|
end
|
74
74
|
|
75
|
+
# TODO: Is the text/unit line needed any more now that Dir.pwd is excluded
|
76
|
+
# from filtering?
|
77
|
+
|
75
78
|
$RUBY_IGNORE_CALLERS ||= []
|
76
79
|
$RUBY_IGNORE_CALLERS.concat([
|
77
80
|
/\/lib\/turn.*\.rb/,
|
78
81
|
/\/bin\/turn/,
|
79
82
|
/\/lib\/minitest.*\.rb/,
|
80
|
-
/\/test\/unit.*\.rb
|
83
|
+
/\/test\/unit(?!(\/.*\_test.rb)|.*\/test_.*).*\.rb.*/
|
81
84
|
])
|
82
85
|
|
83
86
|
# Filter backtrace of unimportant entries, and applies count limit if set in
|
@@ -86,14 +89,14 @@ module Turn
|
|
86
89
|
# as that probably means there was an issue with the test harness itself.
|
87
90
|
def filter_backtrace(backtrace)
|
88
91
|
return [] unless backtrace
|
89
|
-
bt = backtrace.dup
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
bt, pwd = backtrace.dup, Dir.pwd
|
93
|
+
unless $DEBUG
|
94
|
+
bt = bt.reject do |line|
|
95
|
+
$RUBY_IGNORE_CALLERS.any?{|re| re =~ line} unless line.start_with?(pwd)
|
96
|
+
end
|
97
|
+
end
|
95
98
|
bt = backtrace if bt.empty? # if empty just dump the whole thing
|
96
|
-
bt.map{ |line| line.sub(
|
99
|
+
bt.map{ |line| line.sub(pwd+'/', '') }
|
97
100
|
end
|
98
101
|
|
99
102
|
# Limit backtrace to number of lines if `trace` configuration option is set.
|
@@ -19,7 +19,7 @@ module Turn
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def pass(message=nil)
|
22
|
-
io.print Colorize.pass('
|
22
|
+
io.print Colorize.pass('.'); io.flush
|
23
23
|
end
|
24
24
|
|
25
25
|
def fail(assertion, message=nil)
|
@@ -31,7 +31,7 @@ module Turn
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def skip(exception, message=nil)
|
34
|
-
io.print Colorize.skip('
|
34
|
+
io.print Colorize.skip('S'); io.flush
|
35
35
|
end
|
36
36
|
|
37
37
|
def finish_test(test)
|
@@ -87,23 +87,17 @@ module Turn
|
|
87
87
|
|
88
88
|
# After all tests are run, this is the last observable action.
|
89
89
|
def finish_suite(suite)
|
90
|
-
total = "%d tests"
|
91
|
-
passes = "%d passed"
|
92
|
-
assertions = "%d assertions"
|
93
|
-
failures = "%d failures"
|
94
|
-
errors = "%d errors"
|
95
|
-
skips = "%d skips"
|
90
|
+
total = colorize_count("%d tests", suite.count_tests, :bold)
|
91
|
+
passes = colorize_count("%d passed", suite.count_passes, :pass)
|
92
|
+
assertions = colorize_count("%d assertions", suite.count_assertions, nil)
|
93
|
+
failures = colorize_count("%d failures", suite.count_failures, :fail)
|
94
|
+
errors = colorize_count("%d errors", suite.count_errors, :error)
|
95
|
+
skips = colorize_count("%d skips", suite.count_skips, :skip)
|
96
96
|
|
97
97
|
io.puts "Finished in %.6f seconds." % (Time.now - @time)
|
98
98
|
io.puts
|
99
99
|
|
100
|
-
io.puts [
|
101
|
-
Colorize.pass(passes),
|
102
|
-
Colorize.fail(failures),
|
103
|
-
Colorize.error(errors),
|
104
|
-
Colorize.skip(skips),
|
105
|
-
assertions
|
106
|
-
].join(", ")
|
100
|
+
io.puts [ total, passes, failures, errors, skips, assertions ].join(", ")
|
107
101
|
|
108
102
|
# Please keep this newline, since it will be useful when after test case
|
109
103
|
# there will be other lines. For example "rake aborted!" or kind of.
|
@@ -111,6 +105,18 @@ module Turn
|
|
111
105
|
end
|
112
106
|
|
113
107
|
private
|
108
|
+
# Creates an optionally-colorized string describing the number of occurances an event occurred.
|
109
|
+
#
|
110
|
+
# @param [String] str A printf-style string that expects an integer argument (i.e. the count)
|
111
|
+
# @param [Integer] count The number of occurances of the event being described.
|
112
|
+
# @param [nil, Symbol] colorize_method The method on Colorize to call in order to apply color to the result, or nil
|
113
|
+
# to not apply any coloring at all.
|
114
|
+
def colorize_count(str, count, colorize_method)
|
115
|
+
str= str % [count]
|
116
|
+
str= Colorize.send(colorize_method, str) if colorize_method and count != 0
|
117
|
+
str
|
118
|
+
end
|
119
|
+
|
114
120
|
# Outputs test case header for given event (error, fail & etc)
|
115
121
|
#
|
116
122
|
# Example:
|
@@ -66,7 +66,7 @@ module Turn
|
|
66
66
|
# suites are cases in minitest
|
67
67
|
@turn_case = @turn_suite.new_case(suite.name)
|
68
68
|
|
69
|
-
filter = @turn_config.pattern || /./
|
69
|
+
filter = @options[:filter] || @turn_config.pattern || /./
|
70
70
|
|
71
71
|
suite.send("#{type}_methods").grep(filter).each do |test|
|
72
72
|
@turn_case.new_test(test)
|
data/lib/turn/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/helper.rb'
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/..') + '/lib/turn/reporter'
|
3
|
+
|
4
|
+
class TestReporter < Turn::Reporter
|
5
|
+
end
|
6
|
+
|
7
|
+
class TestReporters < Test::Unit::TestCase
|
8
|
+
def test_unit_test_files_are_not_filtered_out_if_ending_in_test
|
9
|
+
reporter = TestReporter.new(nil)
|
10
|
+
|
11
|
+
# If you follow the convention of naming your test files with _test.rb, do not filter that
|
12
|
+
# test file from the stack trace
|
13
|
+
filtered_lines = ["/Users/testman/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit/assertions.rb:185:in `assert_equal'"]
|
14
|
+
unfiltered_lines = ["/Users/testman/source/campaign_manager/test/unit/omg_test.rb:145:in `block in <class:OmgTest>'",
|
15
|
+
"/Users/testman/source/campaign_manager/app/models/omg.rb:145:in `in double_rainbows'" ]
|
16
|
+
stack_trace = filtered_lines + unfiltered_lines
|
17
|
+
|
18
|
+
assert_equal unfiltered_lines, reporter.send(:filter_backtrace, stack_trace)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_unit_test_files_are_not_filtered_out_if_file_name_starts_with_test_underscore
|
22
|
+
reporter = TestReporter.new(nil)
|
23
|
+
|
24
|
+
# If you follow the convention of naming your test files with _test.rb, do not filter that
|
25
|
+
# test file from the stack trace
|
26
|
+
filtered_lines = ["/Users/testman/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/test/unit/assertions.rb:185:in `assert_equal'"]
|
27
|
+
unfiltered_lines = ["/Users/testman/source/campaign_manager/test/unit/test_omgs.rb:145:in `block in <class:OmgTest>'",
|
28
|
+
"/Users/testman/source/campaign_manager/app/models/omg.rb:145:in `in double_rainbows'" ]
|
29
|
+
stack_trace = filtered_lines + unfiltered_lines
|
30
|
+
|
31
|
+
assert_equal unfiltered_lines, reporter.send(:filter_backtrace, stack_trace)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ansi
|
17
|
-
requirement: &
|
17
|
+
requirement: &21312540 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *21312540
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: minitest
|
28
|
-
requirement: &
|
28
|
+
requirement: &21308780 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *21308780
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rake
|
39
|
-
requirement: &
|
39
|
+
requirement: &21307780 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *21307780
|
48
48
|
description: Turn provides a set of alternative runners for MiniTest, both colorful
|
49
49
|
and informative.
|
50
50
|
email:
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/turn/version.rb
|
95
95
|
- lib/turn.rb
|
96
96
|
- test/helper.rb
|
97
|
+
- test/reporter_test.rb
|
97
98
|
- test/runner
|
98
99
|
- test/test_framework.rb
|
99
100
|
- test/test_reporters.rb
|
@@ -136,5 +137,6 @@ rubygems_version: 1.8.11
|
|
136
137
|
signing_key:
|
137
138
|
specification_version: 3
|
138
139
|
summary: Test Reporters (New) -- new output formats for Testing
|
139
|
-
test_files:
|
140
|
+
test_files:
|
141
|
+
- test/reporter_test.rb
|
140
142
|
has_rdoc:
|