turn 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/Gemfile +9 -0
- data/History.txt +26 -1
- data/NOTICE.txt +35 -0
- data/{README.txt → README.md} +36 -33
- data/Version.txt +1 -1
- data/demo/test_autorun_minitest.rb +4 -2
- data/lib/turn.rb +2 -2
- data/lib/turn/autoload.rb +6 -0
- data/lib/turn/autorun/minitest.rb +11 -167
- data/lib/turn/autorun/minitest0.rb +163 -0
- data/lib/turn/autorun/testunit.rb +6 -113
- data/lib/turn/autorun/testunit0.rb +116 -0
- data/lib/turn/colorize.rb +19 -11
- data/lib/turn/command.rb +15 -2
- data/lib/turn/components/method.rb +13 -2
- data/lib/turn/controller.rb +79 -33
- data/lib/turn/reporter.rb +4 -2
- data/lib/turn/reporters/cue_reporter.rb +1 -1
- data/lib/turn/reporters/dot_reporter.rb +5 -1
- data/lib/turn/reporters/outline_reporter.rb +17 -5
- data/lib/turn/reporters/pretty_reporter.rb +24 -17
- data/lib/turn/runners/crossrunner.rb +2 -2
- data/lib/turn/runners/isorunner.rb +11 -10
- data/lib/turn/runners/minirunner.rb +34 -52
- data/lib/turn/runners/solorunner.rb +0 -1
- data/lib/turn/runners/testrunner.rb +12 -15
- data/lib/turn/version.rb +1 -1
- data/license/GPLv2.txt +340 -0
- data/license/MIT-LICENSE.txt +21 -0
- data/license/RUBY-LICENSE.txt +56 -0
- data/test/helper.rb +26 -1
- data/test/test_framework.rb +22 -1
- data/test/test_reporters.rb +1 -1
- data/test/test_runners.rb +13 -4
- data/turn.gemspec +21 -30
- metadata +63 -92
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/History.txt
CHANGED
@@ -1,5 +1,30 @@
|
|
1
|
+
== 0.8.3 / 2011-10-10
|
2
|
+
* Merge pull request #56 from codeinvain/master
|
3
|
+
* Merge pull request #52 from markburns/patch-2
|
4
|
+
* Merge pull request #51 from markburns/patch-1
|
5
|
+
* Merge pull request #50 from tpope/stdout_tty
|
6
|
+
* Switch COLORIZE to method for easier testing
|
7
|
+
* Don't show colors if stdout is not a tty
|
8
|
+
* Use global config.
|
9
|
+
* Autoload Test::Unit and MiniTest.
|
10
|
+
* Autorun uses Turn's runner classes.
|
11
|
+
* minitest changed Unit#run, set Unit.runner= if method exists
|
12
|
+
* Merge pull request #39 from dubek/fix_term_detection_for_ruby_19
|
13
|
+
* Merge pull request #38 from cameel/fix-minitest-run-monkeypatch-no-trace
|
14
|
+
* Merge pull request #36 from yalab/master
|
15
|
+
* Don't use ANSI codes on dumb terminals in Ruby 1.9
|
16
|
+
* Make Turn work with gems that monkey-patch MiniTest::Unit::TestCase.run()
|
17
|
+
* Fixed pretty_reporter to use 'trace' option.
|
18
|
+
* Fixed dot_reporter to use 'trace' option.
|
19
|
+
* Fixed outline_reporter to use 'trace' option.
|
20
|
+
* Add -t or --trace option for display all stacktrace.
|
21
|
+
* missing #skip! method in TestMethod
|
22
|
+
* Merge branch 'master' of github.com:TwP/turn
|
23
|
+
* use autoload to load MiniTests emulation of TestUnit
|
24
|
+
* do not use color if in a VIM session
|
25
|
+
|
1
26
|
== 0.8.2 / 2011-03-31
|
2
|
-
* Add version in code and cli option to
|
27
|
+
* Add version in code and cli option to display it.
|
3
28
|
* Fix for files lookup controller bug
|
4
29
|
* Limit default test matching to *.rb files.
|
5
30
|
* Show first line from the test file when showing stack traces [F. Morgan Whitney]
|
data/NOTICE.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
= Copyright Notices
|
2
|
+
|
3
|
+
== Turn
|
4
|
+
|
5
|
+
Copyright:: (c) 2006-2008 Tim Pease
|
6
|
+
License:: MIT License
|
7
|
+
|
8
|
+
See license/MIT-LICENSE.txt for license details.
|
9
|
+
|
10
|
+
|
11
|
+
== MiniTest
|
12
|
+
|
13
|
+
Copyright:: (c) Ryan Davis, Seattle.rb
|
14
|
+
License:: MIT License
|
15
|
+
|
16
|
+
See license/MIT-LICENSE.txt for license details.
|
17
|
+
|
18
|
+
Turn tightly couples with MiniTest which means in some cases
|
19
|
+
MiniTest code might be reused and modified so Turn will
|
20
|
+
interface with MiniTest effectively.
|
21
|
+
|
22
|
+
|
23
|
+
== TestUnit
|
24
|
+
|
25
|
+
Copyright:: (c) Nathaniel Talbott
|
26
|
+
License:: The Ruby License
|
27
|
+
|
28
|
+
This software is distributed under the same terms as ruby.
|
29
|
+
|
30
|
+
See license/RUBY-LICENSE.txt for detiails.
|
31
|
+
|
32
|
+
Turn tightly couples with TesUnit which means in some cases
|
33
|
+
TestUnit code might be reused and modified so Turn will
|
34
|
+
interface with TestUnit effectively.
|
35
|
+
|
data/{README.txt → README.md}
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# TURN - Test::Unit Reporter (New)
|
2
2
|
by Tim Pease
|
3
3
|
http://codeforpeople.rubyforge.org/turn
|
4
4
|
|
5
|
-
|
5
|
+
## DESCRIPTION:
|
6
6
|
|
7
7
|
TURN is a new way to view Test::Unit results. With longer running tests, it
|
8
8
|
can be very frustrating to see a failure (....F...) and then have to wait till
|
@@ -14,40 +14,44 @@ If you have the 'ansi' gem installed, then TURN output will be displayed in
|
|
14
14
|
wonderful technicolor (but only if your terminal supports ANSI color codes).
|
15
15
|
Well, the only colors are green and red, but that is still color.
|
16
16
|
|
17
|
-
|
17
|
+
<b>Interested in improving Turn?</b> Please read this[https://github.com/TwP/turn/wiki/Implementation].
|
18
|
+
|
19
|
+
## FEATURES:
|
18
20
|
|
19
21
|
General usage provides better test output. Here is some sample output:
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
23
|
+
|
24
|
+
TestMyClass
|
25
|
+
test_alt PASS
|
26
|
+
test_alt_eq PASS
|
27
|
+
test_bad FAIL
|
28
|
+
./test/test_my_class.rb:64:in `test_bad'
|
29
|
+
<false> is not true.
|
30
|
+
test_foo PASS
|
31
|
+
test_foo_eq PASS
|
32
|
+
TestYourClass
|
33
|
+
test_method_a PASS
|
34
|
+
test_method_b PASS
|
35
|
+
test_method_c PASS
|
36
|
+
============================================================================
|
37
|
+
pass: 7, fail: 1, error: 0
|
38
|
+
total: 15 tests with 42 assertions in 0.018 seconds
|
39
|
+
============================================================================
|
40
|
+
|
37
41
|
|
38
42
|
Turn also provides solo and cross test modes when run from the *turn* commandline
|
39
43
|
application.
|
40
44
|
|
41
|
-
|
45
|
+
## SYNOPSIS:
|
42
46
|
|
43
47
|
Turn can be using from the command-line or via require. The command-line tool
|
44
48
|
offers additional options for how one runs tests.
|
45
49
|
|
46
|
-
|
50
|
+
### Command Line
|
47
51
|
|
48
52
|
You can use the *turn* executable in place of the *ruby* interpreter.
|
49
53
|
|
50
|
-
|
54
|
+
$ turn -Ilib test/test_all.rb
|
51
55
|
|
52
56
|
This will invoke the ruby interpreter and automatically require the turn
|
53
57
|
formatting library. All command line arguments are passed "as is" to the
|
@@ -55,41 +59,41 @@ ruby interpreter.
|
|
55
59
|
|
56
60
|
To use the solo runner.
|
57
61
|
|
58
|
-
|
62
|
+
$ turn --solo -Ilib test/
|
59
63
|
|
60
64
|
This will run all tests in the test/ directory in a separate process.
|
61
65
|
Likewise for the cross runner.
|
62
66
|
|
63
|
-
|
67
|
+
$ turn --cross -Ilib test/
|
64
68
|
|
65
69
|
This will run every pairing of tests in a separate process.
|
66
70
|
|
67
|
-
|
71
|
+
### Require
|
68
72
|
|
69
73
|
Simply require the TURN package from within your test suite.
|
70
74
|
|
71
|
-
|
75
|
+
$ require 'turn'
|
72
76
|
|
73
77
|
This will configure Test::Unit to use TURN formatting for displaying test
|
74
78
|
restuls. A better line to use, though, is the following:
|
75
79
|
|
76
|
-
|
80
|
+
begin; require 'turn'; rescue LoadError; end
|
77
81
|
|
78
82
|
When you distribute your code, the test suite can be run without requiring
|
79
83
|
the end user to install the TURN package.
|
80
84
|
|
81
85
|
For a Rails application, put the require line into the 'test/test_helper.rb'
|
82
|
-
|
86
|
+
script. Now your Rails tests will use TURN formatting.
|
83
87
|
|
84
|
-
|
88
|
+
## REQUIREMENTS:
|
85
89
|
|
86
|
-
* ansi 1.1+ (for colorized output and
|
90
|
+
* ansi 1.1+ (for colorized output and progress bar output mode)
|
87
91
|
|
88
|
-
|
92
|
+
## INSTALL:
|
89
93
|
|
90
94
|
* sudo gem install turn
|
91
95
|
|
92
|
-
|
96
|
+
## LICENSE:
|
93
97
|
|
94
98
|
MIT License
|
95
99
|
|
@@ -113,4 +117,3 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
113
117
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
114
118
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
115
119
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
116
|
-
|
data/Version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.3
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'minitest/unit'
|
2
2
|
require 'turn'
|
3
3
|
|
4
|
-
|
4
|
+
Turn.config do |c|
|
5
|
+
c.natural = true
|
6
|
+
end
|
5
7
|
|
6
8
|
class SampleCase1 < MiniTest::Unit::TestCase
|
7
9
|
def test_sample_pass1
|
@@ -15,7 +17,7 @@ class SampleCase1 < MiniTest::Unit::TestCase
|
|
15
17
|
assert_equal(1,2)
|
16
18
|
end
|
17
19
|
def test_sample_fail2
|
18
|
-
|
20
|
+
assert_includes(1,[])
|
19
21
|
end
|
20
22
|
|
21
23
|
def test_sample_error1
|
data/lib/turn.rb
CHANGED
@@ -6,6 +6,8 @@ module Turn
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
require 'turn/autoload'
|
10
|
+
|
9
11
|
unless defined?(Turn::Command)
|
10
12
|
if Turn.minitest?
|
11
13
|
require 'turn/autorun/minitest'
|
@@ -13,7 +15,5 @@ unless defined?(Turn::Command)
|
|
13
15
|
else
|
14
16
|
require 'turn/autorun/testunit'
|
15
17
|
end
|
16
|
-
#autoload :Test, 'turn/autorun/testunit'
|
17
|
-
#autoload :MiniTest, 'turn/autorun/minitest'
|
18
18
|
end
|
19
19
|
|
@@ -1,173 +1,17 @@
|
|
1
|
+
require 'turn/autoload'
|
2
|
+
|
1
3
|
require 'minitest/unit'
|
2
4
|
require 'minitest/spec'
|
3
|
-
#require 'rubygems'
|
4
|
-
require 'ansi'
|
5
|
-
|
6
|
-
class MiniTest::Unit
|
7
|
-
include ANSI::Code
|
8
|
-
|
9
|
-
PADDING_SIZE = 4
|
10
|
-
|
11
|
-
@@use_natural_language_case_names = false
|
12
|
-
def self.use_natural_language_case_names=(boolean)
|
13
|
-
@use_natural_language_case_names = boolean
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.use_natural_language_case_names?
|
17
|
-
@use_natural_language_case_names
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
def run(args = [])
|
22
|
-
@verbose = true
|
23
|
-
|
24
|
-
filter = if args.first =~ /^(-n|--name)$/ then
|
25
|
-
args.shift
|
26
|
-
arg = args.shift
|
27
|
-
if arg =~ /\/(.*)\//
|
28
|
-
Regexp.new($1)
|
29
|
-
elsif MiniTest::Unit.use_natural_language_case_names?
|
30
|
-
# Turn 'sample error1' into 'test_sample_error1'
|
31
|
-
arg[0..4] == "test_" ? arg.gsub(" ", "_") : "test_" + arg.gsub(" ", "_")
|
32
|
-
else
|
33
|
-
arg
|
34
|
-
end
|
35
|
-
else
|
36
|
-
/./ # anything - ^test_ already filtered by #tests
|
37
|
-
end
|
38
|
-
|
39
|
-
@@out.puts "Loaded suite #{$0.sub(/\.rb$/, '')}\nStarted"
|
40
|
-
|
41
|
-
start = Time.now
|
42
|
-
run_test_suites filter
|
43
|
-
|
44
|
-
@@out.puts
|
45
|
-
@@out.puts "Finished in #{'%.6f' % (Time.now - start)} seconds."
|
46
|
-
|
47
|
-
@@out.puts
|
48
|
-
|
49
|
-
@@out.print "%d tests, " % test_count
|
50
|
-
@@out.print "%d assertions, " % assertion_count
|
51
|
-
@@out.print red { "%d failures, " % failures }
|
52
|
-
@@out.print yellow { "%d errors, " % errors }
|
53
|
-
@@out.puts cyan { "%d skips" % skips}
|
54
|
-
|
55
|
-
return failures + errors if @test_count > 0 # or return nil...
|
56
|
-
end
|
57
|
-
|
58
|
-
# Overwrite #run_test_suites so that it prints out reports
|
59
|
-
# as errors are generated.
|
60
|
-
def run_test_suites(filter = /./)
|
61
|
-
@test_count, @assertion_count = 0, 0
|
62
|
-
old_sync, @@out.sync = @@out.sync, true if @@out.respond_to? :sync=
|
63
|
-
TestCase.test_suites.each do |suite|
|
64
|
-
test_cases = suite.test_methods.grep(filter)
|
65
|
-
if test_cases.size > 0
|
66
|
-
@@out.print "\n#{suite}:\n"
|
67
|
-
end
|
68
|
-
|
69
|
-
test_cases.each do |test|
|
70
|
-
inst = suite.new test
|
71
|
-
inst._assertions = 0
|
72
|
-
|
73
|
-
t = Time.now
|
74
|
-
|
75
|
-
@broken = nil
|
76
|
-
|
77
|
-
@@out.print(case inst.run(self)
|
78
|
-
when :pass
|
79
|
-
@broken = false
|
80
|
-
green { pad_with_size "PASS" }
|
81
|
-
when :error
|
82
|
-
@broken = true
|
83
|
-
yellow { pad_with_size "ERROR" }
|
84
|
-
when :fail
|
85
|
-
@broken = true
|
86
|
-
red { pad_with_size "FAIL" }
|
87
|
-
when :skip
|
88
|
-
@broken = false
|
89
|
-
cyan { pad_with_size "SKIP" }
|
90
|
-
end)
|
91
|
-
|
92
|
-
|
93
|
-
@@out.print MiniTest::Unit.use_natural_language_case_names? ?
|
94
|
-
" #{test.gsub("test_", "").gsub(/_/, " ")}" : " #{test}"
|
95
|
-
@@out.print " (%.2fs) " % (Time.now - t)
|
96
|
-
|
97
|
-
if @broken
|
98
|
-
@@out.puts
|
99
|
-
|
100
|
-
report = @report.last
|
101
|
-
@@out.puts pad(report[:message], 10)
|
102
|
-
trace = MiniTest::filter_backtrace(report[:exception].backtrace).first
|
103
|
-
@@out.print pad(trace, 10)
|
104
|
-
|
105
|
-
@@out.puts
|
106
|
-
end
|
107
|
-
|
108
|
-
@@out.puts
|
109
|
-
@test_count += 1
|
110
|
-
@assertion_count += inst._assertions
|
111
|
-
end
|
112
|
-
end
|
113
|
-
@@out.sync = old_sync if @@out.respond_to? :sync=
|
114
|
-
[@test_count, @assertion_count]
|
115
|
-
end
|
116
|
-
|
117
|
-
def pad(str, size=PADDING_SIZE)
|
118
|
-
" " * size + str
|
119
|
-
end
|
120
|
-
|
121
|
-
def pad_with_size(str)
|
122
|
-
pad("%5s" % str)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Overwrite #puke method so that is stores a hash
|
126
|
-
# with :message and :exception keys.
|
127
|
-
def puke(klass, meth, e)
|
128
|
-
result = nil
|
129
|
-
msg = case e
|
130
|
-
when MiniTest::Skip
|
131
|
-
@skips += 1
|
132
|
-
result = :skip
|
133
|
-
e.message
|
134
|
-
when MiniTest::Assertion
|
135
|
-
@failures += 1
|
136
|
-
result = :fail
|
137
|
-
e.message
|
138
|
-
else
|
139
|
-
@errors += 1
|
140
|
-
result = :error
|
141
|
-
"#{e.class}: #{e.message}\n"
|
142
|
-
end
|
143
|
-
|
144
|
-
@report << {:message => msg, :exception => e}
|
145
|
-
result
|
146
|
-
end
|
147
5
|
|
6
|
+
require 'turn/colorize'
|
7
|
+
require 'turn/controller'
|
8
|
+
require 'turn/runners/minirunner'
|
148
9
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
@passed = nil
|
156
|
-
self.setup
|
157
|
-
self.__send__ self.__name__
|
158
|
-
@passed = true
|
159
|
-
rescue Exception => e
|
160
|
-
@passed = false
|
161
|
-
result = runner.puke(self.class, self.__name__, e)
|
162
|
-
ensure
|
163
|
-
begin
|
164
|
-
self.teardown
|
165
|
-
rescue Exception => e
|
166
|
-
result = runner.puke(self.class, self.__name__, e)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
result
|
170
|
-
end
|
171
|
-
end
|
10
|
+
if MiniTest::Unit.respond_to?(:runner=)
|
11
|
+
MiniTest::Unit.runner = Turn::MiniRunner.new
|
12
|
+
else
|
13
|
+
raise "MiniTest v#{MiniTest::Unit::VERSION} is out of date.\n" \
|
14
|
+
"`gem install minitest` and add `gem 'minitest' to you test helper."
|
15
|
+
#MiniTest::Unit = Turn::MiniRunner
|
172
16
|
end
|
173
17
|
|