openlogic-turn 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +54 -0
- data/README.txt +116 -0
- data/Rakefile +40 -0
- data/Release.txt +33 -0
- data/Version.txt +1 -0
- data/bin/turn +4 -0
- data/demo/test_autorun_minitest.rb +26 -0
- data/demo/test_autorun_testunit.rb +26 -0
- data/demo/test_sample.rb +35 -0
- data/demo/test_sample2.rb +33 -0
- data/lib/turn.rb +19 -0
- data/lib/turn/autorun/minitest.rb +155 -0
- data/lib/turn/autorun/testunit.rb +116 -0
- data/lib/turn/bin.rb +4 -0
- data/lib/turn/colorize.rb +65 -0
- data/lib/turn/command.rb +210 -0
- data/lib/turn/components/case.rb +104 -0
- data/lib/turn/components/method.rb +42 -0
- data/lib/turn/components/suite.rb +85 -0
- data/lib/turn/controller.rb +204 -0
- data/lib/turn/core_ext.rb +31 -0
- data/lib/turn/reporter.rb +69 -0
- data/lib/turn/reporters/cue_reporter.rb +167 -0
- data/lib/turn/reporters/dot_reporter.rb +93 -0
- data/lib/turn/reporters/marshal_reporter.rb +17 -0
- data/lib/turn/reporters/outline_reporter.rb +144 -0
- data/lib/turn/reporters/pretty_reporter.rb +184 -0
- data/lib/turn/reporters/progress_reporter.rb +116 -0
- data/lib/turn/runners/crossrunner.rb +42 -0
- data/lib/turn/runners/isorunner.rb +167 -0
- data/lib/turn/runners/loadrunner.rb +48 -0
- data/lib/turn/runners/minirunner.rb +189 -0
- data/lib/turn/runners/solorunner.rb +8 -0
- data/lib/turn/runners/testrunner.rb +166 -0
- 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 +138 -0
data/History.txt
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
== 0.8.1 / 2010-09-10
|
2
|
+
* Fix misspelling of "raised" which prevented proper recording of errors.
|
3
|
+
* Fix IsoRunner so it passes error, not just error message.
|
4
|
+
|
5
|
+
== 0.8.0 / 2010-06-02
|
6
|
+
* Mintest support
|
7
|
+
* Two new reporters
|
8
|
+
|
9
|
+
== 0.7.1 / 2009-12-25
|
10
|
+
* Copied String#tab from Facets.
|
11
|
+
* Facets is no longer needed as direct dependency.
|
12
|
+
|
13
|
+
== 0.7.0 / 2009-10-13
|
14
|
+
* Fix typo and potential bug.
|
15
|
+
* Running ruby with /usr/bin/env for portability
|
16
|
+
* Adding --name=PATTERN for test name filtering
|
17
|
+
* ANSI class is all caps
|
18
|
+
|
19
|
+
== 0.6.3 / 2009-10-12
|
20
|
+
* Fixing require statements
|
21
|
+
|
22
|
+
== 0.6.2 / 2009-10-07
|
23
|
+
* Detecting rails environment and adjusting output accordingly
|
24
|
+
* Colorizing the filename
|
25
|
+
|
26
|
+
== 0.6.1 / 2009-08-26
|
27
|
+
* Switched ANSI color support to ANSI project.
|
28
|
+
|
29
|
+
== 0.6.0 / 2009-05-30
|
30
|
+
* Testrunner @io renamed to @output for test/unit 2.
|
31
|
+
|
32
|
+
== 0.5.1 / 2009-03-25
|
33
|
+
* fixed a "convert nil into String" error
|
34
|
+
|
35
|
+
== 0.4.0 / 2008-09-18
|
36
|
+
* add solo and cross runners
|
37
|
+
* move Colorize into separate file
|
38
|
+
* use ::ANSICode instead of ::Console::ANSICode
|
39
|
+
|
40
|
+
== 0.3.0 / 2007-12-11
|
41
|
+
* color highlighting now works (need facets-2.0 library)
|
42
|
+
|
43
|
+
== 0.2.0 / 2006-11-26
|
44
|
+
* add the "turn" executable
|
45
|
+
* fixed warnings
|
46
|
+
|
47
|
+
== 0.1.2 / 2006-11-13
|
48
|
+
* added some instructions for using the package
|
49
|
+
|
50
|
+
== 0.1.1 / 2006-11-10
|
51
|
+
* removed explicit dependency on the 'hoe' gem
|
52
|
+
|
53
|
+
== 0.1.0 / 2006-11-10
|
54
|
+
* initial release
|
data/README.txt
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
= TURN - Test::Unit Reporter (New)
|
2
|
+
by Tim Pease
|
3
|
+
http://codeforpeople.rubyforge.org/turn
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
TURN is a new way to view Test::Unit results. With longer running tests, it
|
8
|
+
can be very frustrating to see a failure (....F...) and then have to wait till
|
9
|
+
all the tests finish before you can see what the exact failure was. TURN
|
10
|
+
displays each test on a separate line with failures being displayed
|
11
|
+
immediately instead of at the end of the tests.
|
12
|
+
|
13
|
+
If you have the 'ansi' gem installed, then TURN output will be displayed in
|
14
|
+
wonderful technicolor (but only if your terminal supports ANSI color codes).
|
15
|
+
Well, the only colors are green and red, but that is still color.
|
16
|
+
|
17
|
+
== FEATURES:
|
18
|
+
|
19
|
+
General usage provides better test output. Here is some sample output:
|
20
|
+
|
21
|
+
TestMyClass
|
22
|
+
test_alt PASS
|
23
|
+
test_alt_eq PASS
|
24
|
+
test_bad FAIL
|
25
|
+
./test/test_my_class.rb:64:in `test_bad'
|
26
|
+
<false> is not true.
|
27
|
+
test_foo PASS
|
28
|
+
test_foo_eq PASS
|
29
|
+
TestYourClass
|
30
|
+
test_method_a PASS
|
31
|
+
test_method_b PASS
|
32
|
+
test_method_c PASS
|
33
|
+
============================================================================
|
34
|
+
pass: 7, fail: 1, error: 0
|
35
|
+
total: 15 tests with 42 assertions in 0.018 seconds
|
36
|
+
============================================================================
|
37
|
+
|
38
|
+
Turn also provides solo and cross test modes when run from the *turn* commandline
|
39
|
+
application.
|
40
|
+
|
41
|
+
== SYNOPSIS:
|
42
|
+
|
43
|
+
Turn can be using from the command-line or via require. The command-line tool
|
44
|
+
offers additional options for how one runs tests.
|
45
|
+
|
46
|
+
=== Command Line
|
47
|
+
|
48
|
+
You can use the *turn* executable in place of the *ruby* interpreter.
|
49
|
+
|
50
|
+
turn -Ilib test/test_all.rb
|
51
|
+
|
52
|
+
This will invoke the ruby interpreter and automatically require the turn
|
53
|
+
formatting library. All command line arguments are passed "as is" to the
|
54
|
+
ruby interpreter.
|
55
|
+
|
56
|
+
To use the solo runner.
|
57
|
+
|
58
|
+
turn --solo -Ilib test/
|
59
|
+
|
60
|
+
This will run all tests in the test/ directory in a separate process.
|
61
|
+
Likewise for the cross runner.
|
62
|
+
|
63
|
+
turn --cross -Ilib test/
|
64
|
+
|
65
|
+
This will run every pairing of tests in a separate process.
|
66
|
+
|
67
|
+
=== Require
|
68
|
+
|
69
|
+
Simply require the TURN package from within your test suite.
|
70
|
+
|
71
|
+
require 'turn'
|
72
|
+
|
73
|
+
This will configure Test::Unit to use TURN formatting for displaying test
|
74
|
+
restuls. A better line to use, though, is the following:
|
75
|
+
|
76
|
+
begin; require 'turn'; rescue LoadError; end
|
77
|
+
|
78
|
+
When you distribute your code, the test suite can be run without requiring
|
79
|
+
the end user to install the TURN package.
|
80
|
+
|
81
|
+
For a Rails application, put the require line into the 'test/test_helper.rb'
|
82
|
+
scipt. Now your Rails tests will use TURN formatting.
|
83
|
+
|
84
|
+
== REQUIREMENTS:
|
85
|
+
|
86
|
+
* ansi 1.1+ (for colorized output and progressbar output mode)
|
87
|
+
|
88
|
+
== INSTALL:
|
89
|
+
|
90
|
+
* sudo gem install turn
|
91
|
+
|
92
|
+
== LICENSE:
|
93
|
+
|
94
|
+
MIT License
|
95
|
+
|
96
|
+
Copyright (c) 2006-2008
|
97
|
+
|
98
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
99
|
+
a copy of this software and associated documentation files (the
|
100
|
+
'Software'), to deal in the Software without restriction, including
|
101
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
102
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
103
|
+
permit persons to whom the Software is furnished to do so, subject to
|
104
|
+
the following conditions:
|
105
|
+
|
106
|
+
The above copyright notice and this permission notice shall be
|
107
|
+
included in all copies or substantial portions of the Software.
|
108
|
+
|
109
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
110
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
111
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
112
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
113
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
114
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
115
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
116
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
begin
|
2
|
+
require 'bones'
|
3
|
+
rescue LoadError
|
4
|
+
abort '### please install the "bones" gem ###'
|
5
|
+
end
|
6
|
+
|
7
|
+
task :default => 'test'
|
8
|
+
|
9
|
+
Bones {
|
10
|
+
name 'openlogic-turn'
|
11
|
+
summary 'Test::Unit Reporter (New) -- new output format for Test::Unit'
|
12
|
+
authors 'Tim Pease'
|
13
|
+
email 'tim.pease@gmail.com'
|
14
|
+
url 'http://gemcutter.org/gems/turn'
|
15
|
+
version File.read('Version.txt').strip
|
16
|
+
ignore_file '.gitignore'
|
17
|
+
rubyforge.name 'codeforpeople'
|
18
|
+
|
19
|
+
exclude << '^work'
|
20
|
+
rdoc.exclude << '^lib'
|
21
|
+
|
22
|
+
use_gmail
|
23
|
+
|
24
|
+
depend_on 'ansi'
|
25
|
+
depend_on 'bones-git', :development => true
|
26
|
+
}
|
27
|
+
|
28
|
+
# Might be useful one day, so we'll leave it here.
|
29
|
+
#
|
30
|
+
# Rake::TaskManager.class_eval do
|
31
|
+
# def remove_task(task_name)
|
32
|
+
# @tasks.delete(task_name.to_s)
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# def remove_task(task_name)
|
37
|
+
# Rake.application.remove_task(task_name)
|
38
|
+
# end
|
39
|
+
|
40
|
+
# EOF
|
data/Release.txt
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
= Turn 0.8.0
|
2
|
+
|
3
|
+
Version 0.8.0 is a fairly significant release for Turn. This release
|
4
|
+
adds support for Ruby 1.9's Minitest framework. You can even use
|
5
|
+
minitest with Ruby 1.8 by supplying the --minitest option on the turn
|
6
|
+
command line.
|
7
|
+
|
8
|
+
In addition, two new reporters have been a added, a new "pretty" reporter
|
9
|
+
which provides a more a modern "OSX" look (thanks Paydro) and a Cue
|
10
|
+
reporter which seeks user input with each failure or error (thanks
|
11
|
+
Shindo).
|
12
|
+
|
13
|
+
With this release we are encouraging users to move away from using
|
14
|
+
autorun modes. Autorunning is when your test script includes code
|
15
|
+
that "automagically" sets up a test runner, e.g. require 'test/unit'
|
16
|
+
and MiniTest::Unit.autorun, and by simply running the scripts
|
17
|
+
through the ruby interpretor the tests get run. There are a number
|
18
|
+
of problems with this approach. To begin with, running tests this way
|
19
|
+
limits Turn of a single mode of operation (that's no fun!) More
|
20
|
+
importantly it prevents interoperability between the old TestUnit
|
21
|
+
and the new MiniTest systems. By leaving these out and using a
|
22
|
+
commandline runner you can use the same tests for each version of
|
23
|
+
Ruby. This may require some adjutments to build tools, but hell,
|
24
|
+
why not use Turn there too. The Turn::Controller class makes it
|
25
|
+
damn easy.
|
26
|
+
|
27
|
+
One last note. Turn is no longer compatible with TestUnit 2.0+.
|
28
|
+
TestUnit and MiniTest are deverging and after some consideration
|
29
|
+
it was decided that Turn's goal is to support Ruby's native test
|
30
|
+
framework, whatever it may be.
|
31
|
+
|
32
|
+
Enjoy!
|
33
|
+
|
data/Version.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.8.2
|
data/bin/turn
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
require 'turn'
|
3
|
+
|
4
|
+
class SampleCase1 < MiniTest::Unit::TestCase
|
5
|
+
def test_sample_pass1
|
6
|
+
assert_equal(1,1)
|
7
|
+
end
|
8
|
+
def test_sample_pass2
|
9
|
+
assert_equal(2,2)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_sample_fail1
|
13
|
+
assert_equal(1,2)
|
14
|
+
end
|
15
|
+
def test_sample_fail2
|
16
|
+
assert_include(1,[])
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_sample_error1
|
20
|
+
raise StandardError, "Raised exception!"
|
21
|
+
end
|
22
|
+
def test_sample_error2
|
23
|
+
raise StandardError, "Raised another exception!"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'turn'
|
3
|
+
|
4
|
+
class SampleCase1 < Test::Unit::TestCase
|
5
|
+
def test_sample_pass1
|
6
|
+
assert_equal(1,1)
|
7
|
+
end
|
8
|
+
def test_sample_pass2
|
9
|
+
assert_equal(2,2)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_sample_fail1
|
13
|
+
assert_equal(1,2)
|
14
|
+
end
|
15
|
+
def test_sample_fail2
|
16
|
+
assert_include(1,[])
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_sample_error1
|
20
|
+
raise StandardError, "Raised exception!"
|
21
|
+
end
|
22
|
+
def test_sample_error2
|
23
|
+
raise StandardError, "Raised another exception!"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/demo/test_sample.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
class SampleCase1 < Test::Unit::TestCase
|
2
|
+
def test_sample_pass1
|
3
|
+
assert_equal(1,1)
|
4
|
+
end
|
5
|
+
def test_sample_pass2
|
6
|
+
assert_equal(2,2)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_sample_fail1
|
10
|
+
assert_equal(1,2)
|
11
|
+
end
|
12
|
+
def test_sample_fail2
|
13
|
+
assert_include(1,[])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_sample_error1
|
17
|
+
raise StandardError, "Raised exception!"
|
18
|
+
end
|
19
|
+
def test_sample_error2
|
20
|
+
raise StandardError, "Raised another exception!"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
class SampleCase2 < Test::Unit::TestCase
|
26
|
+
def test_sample_pass1
|
27
|
+
assert_equal(1,1)
|
28
|
+
end
|
29
|
+
def test_sample_pass2
|
30
|
+
assert_equal(1,1)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class EmptyCase < Test::Unit::TestCase
|
35
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Sample2Case1 < Test::Unit::TestCase
|
2
|
+
def test_sample_pass1
|
3
|
+
assert_equal(1,1)
|
4
|
+
end
|
5
|
+
def test_sample_pass2
|
6
|
+
assert_equal(2,2)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_sample_fail1
|
10
|
+
assert_equal(1,2)
|
11
|
+
end
|
12
|
+
def test_sample_fail2
|
13
|
+
assert_include(1,[])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_sample_error1
|
17
|
+
raise StandardError, "Raised exception!"
|
18
|
+
end
|
19
|
+
def test_sample_error2
|
20
|
+
raise StandardError, "Raised another exception!"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
class Sample2Case2 < Test::Unit::TestCase
|
26
|
+
def test_sample_pass1
|
27
|
+
assert_equal(1,1)
|
28
|
+
end
|
29
|
+
def test_sample_pass2
|
30
|
+
assert_equal(1,1)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
data/lib/turn.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Turn
|
2
|
+
# Returns +true+ if the ruby version supports minitest.
|
3
|
+
# Otherwise, +false+ is returned.
|
4
|
+
def self.minitest?
|
5
|
+
RUBY_VERSION >= '1.9'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
unless defined?(Turn::Command)
|
10
|
+
if Turn.minitest?
|
11
|
+
require 'turn/autorun/minitest'
|
12
|
+
MiniTest::Unit.autorun
|
13
|
+
else
|
14
|
+
require 'turn/autorun/testunit'
|
15
|
+
end
|
16
|
+
#autoload :Test, 'turn/autorun/testunit'
|
17
|
+
#autoload :MiniTest, 'turn/autorun/minitest'
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
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
|
+
def run(args = [])
|
12
|
+
@verbose = true
|
13
|
+
|
14
|
+
filter = if args.first =~ /^(-n|--name)$/ then
|
15
|
+
args.shift
|
16
|
+
arg = args.shift
|
17
|
+
arg =~ /\/(.*)\// ? Regexp.new($1) : arg
|
18
|
+
else
|
19
|
+
/./ # anything - ^test_ already filtered by #tests
|
20
|
+
end
|
21
|
+
|
22
|
+
@@out.puts "Loaded suite #{$0.sub(/\.rb$/, '')}\nStarted"
|
23
|
+
|
24
|
+
start = Time.now
|
25
|
+
run_test_suites filter
|
26
|
+
|
27
|
+
@@out.puts
|
28
|
+
@@out.puts "Finished in #{'%.6f' % (Time.now - start)} seconds."
|
29
|
+
|
30
|
+
@@out.puts
|
31
|
+
|
32
|
+
@@out.print "%d tests, " % test_count
|
33
|
+
@@out.print "%d assertions, " % assertion_count
|
34
|
+
@@out.print red { "%d failures, " % failures }
|
35
|
+
@@out.print yellow { "%d errors, " % errors }
|
36
|
+
@@out.puts cyan { "%d skips" % skips}
|
37
|
+
|
38
|
+
return failures + errors if @test_count > 0 # or return nil...
|
39
|
+
end
|
40
|
+
|
41
|
+
# Overwrite #run_test_suites so that it prints out reports
|
42
|
+
# as errors are generated.
|
43
|
+
def run_test_suites(filter = /./)
|
44
|
+
@test_count, @assertion_count = 0, 0
|
45
|
+
old_sync, @@out.sync = @@out.sync, true if @@out.respond_to? :sync=
|
46
|
+
TestCase.test_suites.each do |suite|
|
47
|
+
test_cases = suite.test_methods.grep(filter)
|
48
|
+
if test_cases.size > 0
|
49
|
+
@@out.print "\n#{suite}:\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
test_cases.each do |test|
|
53
|
+
inst = suite.new test
|
54
|
+
inst._assertions = 0
|
55
|
+
|
56
|
+
t = Time.now
|
57
|
+
|
58
|
+
@broken = nil
|
59
|
+
|
60
|
+
@@out.print(case inst.run(self)
|
61
|
+
when :pass
|
62
|
+
@broken = false
|
63
|
+
green { pad_with_size "PASS" }
|
64
|
+
when :error
|
65
|
+
@broken = true
|
66
|
+
yellow { pad_with_size "ERROR" }
|
67
|
+
when :fail
|
68
|
+
@broken = true
|
69
|
+
red { pad_with_size "FAIL" }
|
70
|
+
when :skip
|
71
|
+
@broken = false
|
72
|
+
cyan { pad_with_size "SKIP" }
|
73
|
+
end)
|
74
|
+
|
75
|
+
|
76
|
+
@@out.print " #{test}"
|
77
|
+
@@out.print " (%.2fs) " % (Time.now - t)
|
78
|
+
|
79
|
+
if @broken
|
80
|
+
@@out.puts
|
81
|
+
|
82
|
+
report = @report.last
|
83
|
+
@@out.puts pad(report[:message], 10)
|
84
|
+
trace = MiniTest::filter_backtrace(report[:exception].backtrace).first
|
85
|
+
@@out.print pad(trace, 10)
|
86
|
+
|
87
|
+
@@out.puts
|
88
|
+
end
|
89
|
+
|
90
|
+
@@out.puts
|
91
|
+
@test_count += 1
|
92
|
+
@assertion_count += inst._assertions
|
93
|
+
end
|
94
|
+
end
|
95
|
+
@@out.sync = old_sync if @@out.respond_to? :sync=
|
96
|
+
[@test_count, @assertion_count]
|
97
|
+
end
|
98
|
+
|
99
|
+
def pad(str, size=PADDING_SIZE)
|
100
|
+
" " * size + str
|
101
|
+
end
|
102
|
+
|
103
|
+
def pad_with_size(str)
|
104
|
+
pad("%5s" % str)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Overwrite #puke method so that is stores a hash
|
108
|
+
# with :message and :exception keys.
|
109
|
+
def puke(klass, meth, e)
|
110
|
+
result = nil
|
111
|
+
msg = case e
|
112
|
+
when MiniTest::Skip
|
113
|
+
@skips += 1
|
114
|
+
result = :skip
|
115
|
+
e.message
|
116
|
+
when MiniTest::Assertion
|
117
|
+
@failures += 1
|
118
|
+
result = :fail
|
119
|
+
e.message
|
120
|
+
else
|
121
|
+
@errors += 1
|
122
|
+
result = :error
|
123
|
+
"#{e.class}: #{e.message}\n"
|
124
|
+
end
|
125
|
+
|
126
|
+
@report << {:message => msg, :exception => e}
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
class TestCase
|
132
|
+
# Overwrite #run method so that is uses symbols
|
133
|
+
# as return values rather than characters.
|
134
|
+
def run(runner)
|
135
|
+
result = :pass
|
136
|
+
begin
|
137
|
+
@passed = nil
|
138
|
+
self.setup
|
139
|
+
self.__send__ self.__name__
|
140
|
+
@passed = true
|
141
|
+
rescue Exception => e
|
142
|
+
@passed = false
|
143
|
+
result = runner.puke(self.class, self.__name__, e)
|
144
|
+
ensure
|
145
|
+
begin
|
146
|
+
self.teardown
|
147
|
+
rescue Exception => e
|
148
|
+
result = runner.puke(self.class, self.__name__, e)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
result
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|