turn 0.8.3 → 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/.gitignore +4 -0
- data/Gemfile +1 -8
- data/History.txt +16 -0
- data/{license/GPLv2.txt → LICENSE-GPL2.txt} +0 -0
- data/{license/MIT-LICENSE.txt → LICENSE-MIT.txt} +0 -0
- data/{license/RUBY-LICENSE.txt → LICENSE-RUBY.txt} +0 -0
- data/{NOTICE.txt → LICENSE.txt} +1 -1
- data/README.md +26 -0
- data/Rakefile +1 -0
- data/Version.txt +1 -1
- data/bin/turn +7 -1
- data/lib/turn.rb +20 -11
- data/lib/turn/autoload.rb +1 -1
- data/lib/turn/autorun.rb +8 -0
- data/lib/turn/bin.rb +7 -1
- data/lib/turn/colorize.rb +26 -10
- data/lib/turn/command.rb +32 -13
- data/lib/turn/components.rb +4 -0
- data/lib/turn/components/case.rb +1 -1
- data/lib/turn/components/suite.rb +9 -3
- data/lib/turn/configuration.rb +197 -0
- data/lib/turn/controller.rb +15 -206
- data/lib/turn/{autorun/minitest.rb → minitest.rb} +7 -3
- data/lib/turn/reporter.rb +65 -10
- data/lib/turn/reporters/cue_reporter.rb +13 -2
- data/lib/turn/reporters/dot_reporter.rb +12 -11
- data/lib/turn/reporters/outline_reporter.rb +57 -36
- data/lib/turn/reporters/pretty_reporter.rb +37 -24
- data/lib/turn/reporters/progress_reporter.rb +64 -26
- data/lib/turn/runners/minirunner.rb +7 -32
- data/lib/turn/testunit.rb +5 -0
- data/test/helper.rb +11 -2
- data/test/test_framework.rb +39 -30
- data/test/test_runners.rb +9 -7
- data/{demo → try}/test_autorun_minitest.rb +0 -0
- data/{demo → try}/test_autorun_testunit.rb +0 -0
- data/{demo → try}/test_counts.rb +0 -0
- data/{demo → try}/test_sample.rb +0 -0
- data/{demo → try}/test_sample2.rb +0 -0
- data/turn.gemspec +2 -2
- metadata +42 -29
- data/lib/turn/autorun/minitest0.rb +0 -163
- data/lib/turn/autorun/testunit.rb +0 -9
- data/lib/turn/autorun/testunit0.rb +0 -116
data/.gitignore
ADDED
data/Gemfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
== 0.9.0 / 2012-01-30
|
2
|
+
* Fix bundle exec issue, which means...
|
3
|
+
* Developer's must require `turn/autorun` instead fo just `turn`.
|
4
|
+
* Improve detection of TestUnit 1.x vs. MiniTest
|
5
|
+
* Show randomization seed number in output.
|
6
|
+
* Pretty format option is now `-R` instead of `-T`.
|
7
|
+
* Rename case match shortcut to `-c` instead of `-t`.
|
8
|
+
* Add support for skipped tests.
|
9
|
+
* Support max backtrace limit via `-b` option.
|
10
|
+
* Use $RUBY_IGNORE_CALLERS to ignore lines of backtrace.
|
11
|
+
* Better color support on Windows (install ANSICON)
|
12
|
+
* MiniTest is a dependency (even if you are using it for TestUnit 1.x).
|
13
|
+
|
14
|
+
== 0.8.4 / 2011-11-11
|
15
|
+
* Now must use MiniTest 2.0+.
|
16
|
+
|
1
17
|
== 0.8.3 / 2011-10-10
|
2
18
|
* Merge pull request #56 from codeinvain/master
|
3
19
|
* Merge pull request #52 from markburns/patch-2
|
File without changes
|
File without changes
|
File without changes
|
data/{NOTICE.txt → LICENSE.txt}
RENAMED
@@ -25,7 +25,7 @@ interface with MiniTest effectively.
|
|
25
25
|
Copyright:: (c) Nathaniel Talbott
|
26
26
|
License:: The Ruby License
|
27
27
|
|
28
|
-
This software is distributed under the same terms as
|
28
|
+
This software is distributed under the same terms as Ruby.
|
29
29
|
|
30
30
|
See license/RUBY-LICENSE.txt for detiails.
|
31
31
|
|
data/README.md
CHANGED
@@ -85,6 +85,32 @@ the end user to install the TURN package.
|
|
85
85
|
For a Rails application, put the require line into the 'test/test_helper.rb'
|
86
86
|
script. Now your Rails tests will use TURN formatting.
|
87
87
|
|
88
|
+
|
89
|
+
## RAILS/BUNDLER USERS
|
90
|
+
|
91
|
+
Bundler automatically requires everything listed in your Gemfile, e.g.
|
92
|
+
when using `bundle exec`. This means `turn` will get automatically
|
93
|
+
required too, which in turn means the Turn's test autorunner is doing
|
94
|
+
to kick in. Obviously we don't want that to happen unless we are actually
|
95
|
+
running tests.
|
96
|
+
|
97
|
+
Turn was created well before Bundler existed, and the use of `require 'turn'`
|
98
|
+
as the autorunner was the obvious convenience. Unfortunately Bundler's choice
|
99
|
+
to force require all requirements by defualt can have unexpected consequences,
|
100
|
+
as is the case here.
|
101
|
+
|
102
|
+
Thankfully there is a work around. In your Gemfile add:
|
103
|
+
|
104
|
+
gem 'turn', :require => false
|
105
|
+
|
106
|
+
The `:require` option will prevent Turn from trying to autorun tests.
|
107
|
+
|
108
|
+
In the future we will change turn to use `reuqire 'turn/autorun'` instead,
|
109
|
+
but that will require a lot of people to update a lot of tests, so it's not
|
110
|
+
something to do lightly. Full change over will wait until the 1.0 release.
|
111
|
+
In the mean time Turn will just put out a warning.
|
112
|
+
|
113
|
+
|
88
114
|
## REQUIREMENTS:
|
89
115
|
|
90
116
|
* ansi 1.1+ (for colorized output and progress bar output mode)
|
data/Rakefile
CHANGED
data/Version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/bin/turn
CHANGED
data/lib/turn.rb
CHANGED
@@ -1,19 +1,28 @@
|
|
1
|
+
#
|
1
2
|
module Turn
|
2
|
-
#
|
3
|
-
|
4
|
-
|
5
|
-
RUBY_VERSION >= '1.9'
|
3
|
+
# Are we using Test::Unit (1.x)?
|
4
|
+
def self.testunit?
|
5
|
+
defined?(Test::Unit) && !defined?(MiniTest)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
require 'turn/version'
|
9
12
|
require 'turn/autoload'
|
13
|
+
require 'turn/configuration'
|
14
|
+
require 'turn/colorize'
|
15
|
+
require 'turn/components'
|
16
|
+
require 'turn/controller'
|
10
17
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
else
|
16
|
-
require 'turn/autorun/testunit'
|
17
|
-
end
|
18
|
+
if Turn.testunit?
|
19
|
+
require 'turn/testunit'
|
20
|
+
else
|
21
|
+
require 'turn/minitest'
|
18
22
|
end
|
19
23
|
|
24
|
+
#if ENV['autorun']
|
25
|
+
# warn "Use `require 'turn/autorun'` instead of `require 'turn'` for future versions."
|
26
|
+
# MiniTest::Unit.autorun
|
27
|
+
#end
|
28
|
+
|
data/lib/turn/autoload.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This is a "dirty trick" to load `test/unit` or `minitest/unit` if sought.
|
2
2
|
# Eventually a way to handle this more robustly (without autoreload)
|
3
|
-
# should be worked out.
|
3
|
+
# should be worked out. But how?
|
4
4
|
autoload "Test", 'test/unit'
|
5
5
|
autoload "MiniTest", 'minitest/unit'
|
6
6
|
|
data/lib/turn/autorun.rb
ADDED
data/lib/turn/bin.rb
CHANGED
data/lib/turn/colorize.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'turn/configuration' # why is this needed here?
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'ansi/code'
|
3
5
|
rescue LoadError
|
@@ -10,17 +12,30 @@ end
|
|
10
12
|
|
11
13
|
module Turn
|
12
14
|
|
15
|
+
# Provides a uniform interface for colorizing Turn output.
|
16
|
+
#
|
13
17
|
module Colorize
|
14
18
|
|
15
19
|
COLORLESS_TERMINALS = ['dumb']
|
16
20
|
|
17
|
-
def colorize?
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
def self.colorize?
|
22
|
+
@colorize ||= (
|
23
|
+
ansi = Turn.config.ansi?
|
24
|
+
if ansi.nil?
|
25
|
+
color_supported?
|
26
|
+
else
|
27
|
+
Turn.config.ansi?
|
28
|
+
end
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.color_supported?
|
33
|
+
return false unless defined?(::ANSI::Code)
|
34
|
+
return false unless $stdout.tty?
|
35
|
+
return true if ENV.has_key?('TERM') && !COLORLESS_TERMINALS.include?(ENV['TERM'])
|
36
|
+
return true if ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ && ENV.has_key?('ANSICON')
|
37
|
+
return false
|
22
38
|
end
|
23
|
-
module_function :colorize?
|
24
39
|
|
25
40
|
def self.red(string)
|
26
41
|
colorize? ? ::ANSI::Code.red{ string } : string
|
@@ -50,11 +65,8 @@ module Turn
|
|
50
65
|
colorize? ? ::ANSI::Code.red{ string } : string
|
51
66
|
end
|
52
67
|
|
53
|
-
#def self.error(string)
|
54
|
-
# colorize? ? ::ANSI::Code.white{ ::ANSI::Code.on_red{ string } } : string
|
55
|
-
#end
|
56
|
-
|
57
68
|
def self.error(string)
|
69
|
+
#colorize? ? ::ANSI::Code.white_on_red{ string } : string
|
58
70
|
colorize? ? ::ANSI::Code.yellow{ string } : string
|
59
71
|
end
|
60
72
|
|
@@ -67,6 +79,10 @@ module Turn
|
|
67
79
|
ERROR = error('ERROR')
|
68
80
|
SKIP = skip('SKIP')
|
69
81
|
|
82
|
+
def colorize?
|
83
|
+
Colorize.colorize?
|
84
|
+
end
|
85
|
+
|
70
86
|
end
|
71
87
|
|
72
88
|
end
|
data/lib/turn/command.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'optparse'
|
2
|
+
require 'turn'
|
2
3
|
|
3
4
|
module Turn
|
4
|
-
require 'turn/controller'
|
5
5
|
|
6
6
|
# Turn - Pretty Unit Test Runner for Ruby
|
7
7
|
#
|
@@ -13,10 +13,11 @@ module Turn
|
|
13
13
|
# --live don't use loadpath
|
14
14
|
# --log log results to a file
|
15
15
|
# -n --name=PATTERN only run tests that match regexp PATTERN
|
16
|
+
# -c --case=PATTERN only run testcases that match regexp PATTERN
|
16
17
|
# -I --loadpath=PATHS add given PATHS to the $LOAD_PATH
|
17
18
|
# -r --requires=LIBS require given LIBS before running tests
|
18
19
|
# -m --minitest Force use of MiniTest framework.
|
19
|
-
# -
|
20
|
+
# -b --backtrace=INT Set the number of lines to show in backtrace.
|
20
21
|
#
|
21
22
|
# RUN MODES
|
22
23
|
# --normal run all tests in a single process [default]
|
@@ -27,9 +28,9 @@ module Turn
|
|
27
28
|
# -O --outline turn's original case/test outline mode [default]
|
28
29
|
# -P --progress indicates progress with progress bar
|
29
30
|
# -D --dotted test/unit's traditonal dot-progress mode
|
30
|
-
#
|
31
|
+
# -R --pretty new pretty reporter
|
31
32
|
# -M --marshal dump output as YAML (normal run mode only)
|
32
|
-
# -
|
33
|
+
# -C --cue interactive testing
|
33
34
|
#
|
34
35
|
class Command
|
35
36
|
|
@@ -57,7 +58,7 @@ module Turn
|
|
57
58
|
attr :requires
|
58
59
|
|
59
60
|
# Framework to use, :minitest or :testunit.
|
60
|
-
attr :framework
|
61
|
+
#attr :framework
|
61
62
|
|
62
63
|
# Run mode.
|
63
64
|
attr :runmode
|
@@ -68,6 +69,12 @@ module Turn
|
|
68
69
|
# Enable full backtrace
|
69
70
|
attr :trace
|
70
71
|
|
72
|
+
# Use natural test case names.
|
73
|
+
attr :natural
|
74
|
+
|
75
|
+
# Force ANSI use on or off.
|
76
|
+
attr :ansi
|
77
|
+
|
71
78
|
#
|
72
79
|
def initialize
|
73
80
|
@live = nil
|
@@ -78,8 +85,10 @@ module Turn
|
|
78
85
|
@requires = []
|
79
86
|
@runmode = nil
|
80
87
|
@outmode = nil
|
81
|
-
|
88
|
+
#@framework = RUBY_VERSION >= "1.9" ? :minitest : :testunit
|
82
89
|
@trace = nil
|
90
|
+
@natural = false
|
91
|
+
@ansi = nil
|
83
92
|
end
|
84
93
|
|
85
94
|
#
|
@@ -111,7 +120,7 @@ module Turn
|
|
111
120
|
end
|
112
121
|
end
|
113
122
|
|
114
|
-
opts.on('-
|
123
|
+
opts.on('-c', '--case=PATTERN', "only run test cases that match PATTERN") do |pattern|
|
115
124
|
if pattern =~ /\/(.*)\//
|
116
125
|
@matchcase = Regexp.new($1)
|
117
126
|
else
|
@@ -119,12 +128,20 @@ module Turn
|
|
119
128
|
end
|
120
129
|
end
|
121
130
|
|
122
|
-
opts.on('-m', '--minitest', "Force use of MiniTest framework") do
|
123
|
-
|
131
|
+
#opts.on('-m', '--minitest', "Force use of MiniTest framework") do
|
132
|
+
# @framework = :minitest
|
133
|
+
#end
|
134
|
+
|
135
|
+
opts.on('-b', '--backtrace', '--trace INT', "Limit the number of lines of backtrace.") do |int|
|
136
|
+
@trace = int
|
137
|
+
end
|
138
|
+
|
139
|
+
opts.on('--natural', "Show natualized test names.") do |bool|
|
140
|
+
@natural = bool
|
124
141
|
end
|
125
142
|
|
126
|
-
opts.on(
|
127
|
-
@
|
143
|
+
opts.on('--[no-]ansi', "Force use of ANSI codes on or off.") do |bool|
|
144
|
+
@ansi = bool
|
128
145
|
end
|
129
146
|
|
130
147
|
# Turn does not support Test::Unit 2.0+
|
@@ -173,7 +190,7 @@ module Turn
|
|
173
190
|
@outmode = :dotted
|
174
191
|
end
|
175
192
|
|
176
|
-
opts.on('--pretty', '-T', "new pretty output mode") do
|
193
|
+
opts.on('--pretty', '-R', '-T', "new pretty output mode") do
|
177
194
|
@outmode = :pretty
|
178
195
|
end
|
179
196
|
|
@@ -225,8 +242,10 @@ module Turn
|
|
225
242
|
c.format = outmode
|
226
243
|
c.pattern = pattern
|
227
244
|
c.matchcase = matchcase
|
228
|
-
c.framework = framework
|
245
|
+
#c.framework = framework
|
229
246
|
c.trace = trace
|
247
|
+
c.natural = natural
|
248
|
+
c.ansi = ansi unless ansi.nil?
|
230
249
|
end
|
231
250
|
|
232
251
|
controller = Turn::Controller.new(config)
|
data/lib/turn/components/case.rb
CHANGED
@@ -6,18 +6,19 @@ module Turn
|
|
6
6
|
include Enumerable
|
7
7
|
|
8
8
|
attr_accessor :name
|
9
|
-
attr_accessor :size
|
10
9
|
attr_accessor :cases
|
10
|
+
attr_accessor :seed
|
11
11
|
|
12
12
|
# This one can be set manually since it
|
13
13
|
# is not calculatable (beyond the case level).
|
14
|
-
|
14
|
+
attr_writer :count_assertions
|
15
15
|
|
16
16
|
#
|
17
17
|
def initialize(name=nil)
|
18
18
|
@name = name
|
19
|
-
@size = nil
|
20
19
|
@cases = []
|
20
|
+
@size = nil
|
21
|
+
@seed = nil
|
21
22
|
|
22
23
|
#@count_tests = nil
|
23
24
|
#@count_assertions = nil
|
@@ -76,6 +77,11 @@ module Turn
|
|
76
77
|
@size ||= @cases.size
|
77
78
|
end
|
78
79
|
|
80
|
+
# Why the size would ever have to overridden... well who can say.
|
81
|
+
def size=(number)
|
82
|
+
@size = number.to_i
|
83
|
+
end
|
84
|
+
|
79
85
|
def passed?
|
80
86
|
(count_failures == 0 && count_errors == 0)
|
81
87
|
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
module Turn
|
2
|
+
|
3
|
+
# Configure Turn
|
4
|
+
def self.config(&block)
|
5
|
+
@config ||= Configuration.new
|
6
|
+
block.call(@config) if block
|
7
|
+
@config
|
8
|
+
end
|
9
|
+
|
10
|
+
# TODO: Support for test run loggging ?
|
11
|
+
|
12
|
+
# Central interface for Turn configuration.
|
13
|
+
#
|
14
|
+
class Configuration
|
15
|
+
|
16
|
+
# List of if file names or glob pattern of tests to run.
|
17
|
+
attr_reader :tests
|
18
|
+
|
19
|
+
# List of file names or globs to exclude from +tests+ list.
|
20
|
+
attr_reader :exclude
|
21
|
+
|
22
|
+
# Regexp pattern that all test name's must
|
23
|
+
# match to be eligible to run.
|
24
|
+
attr_accessor :pattern
|
25
|
+
|
26
|
+
# Regexp pattern that all test cases must
|
27
|
+
# match to be eligible to run.
|
28
|
+
attr_accessor :matchcase
|
29
|
+
|
30
|
+
# Add these folders to the $LOAD_PATH.
|
31
|
+
attr_reader :loadpath
|
32
|
+
|
33
|
+
# Libs to require when running tests.
|
34
|
+
attr_reader :requires
|
35
|
+
|
36
|
+
# Reporter type.
|
37
|
+
attr_accessor :format
|
38
|
+
|
39
|
+
# Run mode.
|
40
|
+
attr_accessor :runmode
|
41
|
+
|
42
|
+
# Test against live install (i.e. Don't use loadpath option)
|
43
|
+
attr_accessor :live
|
44
|
+
|
45
|
+
# Log results? May be true/false or log file name. (TODO)
|
46
|
+
attr_accessor :log
|
47
|
+
|
48
|
+
# Verbose output?
|
49
|
+
attr_accessor :verbose
|
50
|
+
|
51
|
+
# Test framework, either :minitest or :testunit
|
52
|
+
attr_accessor :framework
|
53
|
+
|
54
|
+
# Enable full backtrace
|
55
|
+
attr_accessor :trace
|
56
|
+
|
57
|
+
# Use natural language case names.
|
58
|
+
attr_accessor :natural
|
59
|
+
|
60
|
+
def verbose? ; @verbose ; end
|
61
|
+
def live? ; @live ; end
|
62
|
+
def natural? ; @natural ; end
|
63
|
+
def ansi? ; @ansi ; end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def initialize
|
68
|
+
yield(self) if block_given?
|
69
|
+
initialize_defaults
|
70
|
+
end
|
71
|
+
|
72
|
+
#
|
73
|
+
def initialize_defaults
|
74
|
+
@loadpath ||= ['lib']
|
75
|
+
@tests ||= ["test/**/{test,}*{,test}.rb"]
|
76
|
+
@exclude ||= []
|
77
|
+
@requires ||= []
|
78
|
+
@live ||= false
|
79
|
+
@log ||= true
|
80
|
+
#@format ||= nil
|
81
|
+
#@runner ||= RUBY_VERSION >= "1.9" ? MiniRunner : TestRunner
|
82
|
+
@matchcase ||= nil
|
83
|
+
@pattern ||= /.*/
|
84
|
+
@natural ||= false
|
85
|
+
@trace ||= environment_trace
|
86
|
+
@ansi ||= nil
|
87
|
+
|
88
|
+
@files = nil # reset files just in case
|
89
|
+
end
|
90
|
+
|
91
|
+
# Collect test configuation.
|
92
|
+
#def test_configuration(options={})
|
93
|
+
# #options = configure_options(options, 'test')
|
94
|
+
# #options['loadpath'] ||= metadata.loadpath
|
95
|
+
# options['tests'] ||= self.tests
|
96
|
+
# options['loadpath'] ||= self.loadpath
|
97
|
+
# options['requires'] ||= self.requires
|
98
|
+
# options['live'] ||= self.live
|
99
|
+
# options['exclude'] ||= self.exclude
|
100
|
+
# #options['tests'] = list_option(options['tests'])
|
101
|
+
# options['loadpath'] = list_option(options['loadpath'])
|
102
|
+
# options['exclude'] = list_option(options['exclude'])
|
103
|
+
# options['require'] = list_option(options['require'])
|
104
|
+
# return options
|
105
|
+
#end
|
106
|
+
|
107
|
+
#
|
108
|
+
def list_option(list)
|
109
|
+
case list
|
110
|
+
when nil
|
111
|
+
[]
|
112
|
+
when Array
|
113
|
+
list
|
114
|
+
else
|
115
|
+
list.split(/[:;]/)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
public
|
120
|
+
|
121
|
+
def ansi=(boolean)
|
122
|
+
@ansi = boolean ? true : false
|
123
|
+
end
|
124
|
+
|
125
|
+
def tests=(paths)
|
126
|
+
@tests = list_option(paths)
|
127
|
+
end
|
128
|
+
|
129
|
+
def loadpath=(paths)
|
130
|
+
@loadpath = list_option(paths)
|
131
|
+
end
|
132
|
+
|
133
|
+
def exclude=(paths)
|
134
|
+
@exclude = list_option(paths)
|
135
|
+
end
|
136
|
+
|
137
|
+
def requires=(paths)
|
138
|
+
@requires = list_option(paths)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Test files.
|
142
|
+
def files
|
143
|
+
@files ||= (
|
144
|
+
fs = tests.map do |t|
|
145
|
+
File.directory?(t) ? Dir[File.join(t, '**', '*')] : Dir[t]
|
146
|
+
end
|
147
|
+
fs = fs.flatten.reject{ |f| File.directory?(f) }
|
148
|
+
|
149
|
+
ex = exclude.map do |x|
|
150
|
+
File.directory?(x) ? Dir[File.join(x, '**', '*')] : Dir[x]
|
151
|
+
end
|
152
|
+
ex = ex.flatten.reject{ |f| File.directory?(f) }
|
153
|
+
|
154
|
+
(fs - ex).uniq.map{ |f| File.expand_path(f) }
|
155
|
+
).flatten
|
156
|
+
end
|
157
|
+
|
158
|
+
# TODO: Better name ?
|
159
|
+
def suite_name
|
160
|
+
files.map{ |path| File.dirname(path).sub(Dir.pwd+'/','') }.uniq.join(',')
|
161
|
+
end
|
162
|
+
|
163
|
+
# Select reporter based on output mode.
|
164
|
+
def reporter
|
165
|
+
@reporter ||= (
|
166
|
+
opts = { :trace=>trace, :natural=>natural? }
|
167
|
+
case format
|
168
|
+
when :marshal
|
169
|
+
require 'turn/reporters/marshal_reporter'
|
170
|
+
Turn::MarshalReporter.new($stdout, opts)
|
171
|
+
when :progress
|
172
|
+
require 'turn/reporters/progress_reporter'
|
173
|
+
Turn::ProgressReporter.new($stdout, opts)
|
174
|
+
when :dotted, :dot
|
175
|
+
require 'turn/reporters/dot_reporter'
|
176
|
+
Turn::DotReporter.new($stdout, opts)
|
177
|
+
when :pretty
|
178
|
+
require 'turn/reporters/pretty_reporter'
|
179
|
+
Turn::PrettyReporter.new($stdout, opts)
|
180
|
+
when :cue
|
181
|
+
require 'turn/reporters/cue_reporter'
|
182
|
+
Turn::CueReporter.new($stdout, opts)
|
183
|
+
else
|
184
|
+
require 'turn/reporters/outline_reporter'
|
185
|
+
Turn::OutlineReporter.new($stdout, opts)
|
186
|
+
end
|
187
|
+
)
|
188
|
+
end
|
189
|
+
|
190
|
+
#
|
191
|
+
def environment_trace
|
192
|
+
(ENV['backtrace'] ? ENV['backtrace'].to_i : nil)
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|