turn 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +13 -0
- data/bin/turn +14 -0
- data/lib/turn.rb +23 -21
- metadata +7 -6
data/README.txt
CHANGED
@@ -9,9 +9,22 @@
|
|
9
9
|
|
10
10
|
If you have the 'facets' gem installed, then TURN output will be displayed in
|
11
11
|
wonderful technicolor (but only if your terminal supports ANSI color codes).
|
12
|
+
Well, the only colors are green and red, but that is still color.
|
12
13
|
|
13
14
|
== Usage
|
14
15
|
|
16
|
+
=== Command Line
|
17
|
+
|
18
|
+
You can use the *turn* executable in place of the *ruby* interpreter.
|
19
|
+
|
20
|
+
turn -Ilib test/test_all.rb
|
21
|
+
|
22
|
+
This will invoke the ruby interpreter and automatically require the turn
|
23
|
+
formatting library. All command line arguments are passed "as is" to the
|
24
|
+
ruby interpreter.
|
25
|
+
|
26
|
+
=== Require
|
27
|
+
|
15
28
|
Simply require the TURN package from within your test suite.
|
16
29
|
|
17
30
|
require 'turn'
|
data/bin/turn
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'turn'
|
7
|
+
Kernel.exec(RUBY, '-r', 'turn', *ARGV)
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems'
|
10
|
+
require 'turn'
|
11
|
+
Kernel.exec(RUBY, '-rubygems', '-r', 'turn', *ARGV)
|
12
|
+
end
|
13
|
+
|
14
|
+
# EOF
|
data/lib/turn.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: turn.rb
|
1
|
+
# $Id: turn.rb 55 2006-11-19 20:37:40Z tpease $
|
2
2
|
|
3
3
|
require 'test/unit/ui/console/testrunner'
|
4
4
|
begin
|
@@ -17,23 +17,25 @@ module UI
|
|
17
17
|
module Console
|
18
18
|
class TestRunner
|
19
19
|
|
20
|
+
alias :t_attach_to_mediator :attach_to_mediator
|
20
21
|
def attach_to_mediator
|
21
|
-
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:
|
22
|
-
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:
|
23
|
-
@mediator.add_listener(TestCase::STARTED, &method(:
|
24
|
-
@mediator.add_listener(TestCase::FINISHED, &method(:
|
25
|
-
@mediator.add_listener(TestResult::FAULT, &method(:
|
22
|
+
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:t_started))
|
23
|
+
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:t_finished))
|
24
|
+
@mediator.add_listener(TestCase::STARTED, &method(:t_test_started))
|
25
|
+
@mediator.add_listener(TestCase::FINISHED, &method(:t_test_finished))
|
26
|
+
@mediator.add_listener(TestResult::FAULT, &method(:t_fault))
|
26
27
|
@io.sync = true
|
28
|
+
@t_cur_file, @t_fault = nil
|
27
29
|
end
|
28
30
|
|
29
|
-
def
|
30
|
-
@
|
31
|
+
def t_started( result )
|
32
|
+
@t_result = result
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
34
|
-
failure = @
|
35
|
-
error = @
|
36
|
-
total = @
|
35
|
+
def t_finished( elapsed_time )
|
36
|
+
failure = @t_result.failure_count
|
37
|
+
error = @t_result.error_count
|
38
|
+
total = @t_result.run_count
|
37
39
|
pass = total - failure - error
|
38
40
|
|
39
41
|
bar = '=' * 78
|
@@ -44,26 +46,26 @@ module Console
|
|
44
46
|
|
45
47
|
@io.puts bar
|
46
48
|
@io.puts " pass: %d, fail: %d, error: %d" % [pass, failure, error]
|
47
|
-
@io.puts " total: %d tests with %d assertions in #{elapsed_time} seconds" % [total, @
|
49
|
+
@io.puts " total: %d tests with %d assertions in #{elapsed_time} seconds" % [total, @t_result.assertion_count]
|
48
50
|
@io.puts bar
|
49
51
|
end
|
50
52
|
|
51
|
-
def
|
53
|
+
def t_test_started( name )
|
52
54
|
method, file = name.scan(%r/^([^\(]+)\(([^\)]+)\)/o).flatten!
|
53
|
-
if @
|
54
|
-
@
|
55
|
+
if @t_cur_file != file
|
56
|
+
@t_cur_file = file
|
55
57
|
@io.puts file
|
56
58
|
end
|
57
59
|
@io.print " %-69s" % method
|
58
60
|
end
|
59
61
|
|
60
|
-
def
|
61
|
-
@io.puts PASS unless @
|
62
|
-
@
|
62
|
+
def t_test_finished( name )
|
63
|
+
@io.puts PASS unless @t_fault
|
64
|
+
@t_fault = false
|
63
65
|
end
|
64
66
|
|
65
|
-
def
|
66
|
-
@
|
67
|
+
def t_fault( fault )
|
68
|
+
@t_fault = true
|
67
69
|
msg = "\t"
|
68
70
|
|
69
71
|
case fault
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: turn
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-11-
|
8
|
-
summary: Test::Unit Reporter New -- new output format for Test::Unit
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2006-11-26 00:00:00 -07:00
|
8
|
+
summary: Test::Unit Reporter (New) -- new output format for Test::Unit
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: tim.pease@gmail.com
|
12
12
|
homepage:
|
13
13
|
rubyforge_project: codeforpeople.com
|
14
|
-
description: "
|
14
|
+
description: "TURN is a new way to view Test::Unit results. With longer running tests, it can be very frustrating to see a failure (....F...) and then have to wait till all the tests finish before you can see what the exact failure was. TURN displays each test on a separate line with failures being displayed immediately instead of at the end of the tests. If you have the 'facets' gem installed, then TURN output will be displayed in wonderful technicolor (but only if your terminal supports ANSI color codes). Well, the only colors are green and red, but that is still color. Sample output: TestMyClass test_alt PASS test_alt_eq PASS test_bad FAIL ./test/test_my_class.rb:64:in `test_bad' <false> is not true. test_foo PASS test_foo_eq PASS TestYourClass test_method_a PASS test_method_b PASS test_method_c PASS ============================================================================ pass: 7, fail: 1, error: 0 total: 15 tests with 42 assertions in 0.018 seconds ============================================================================"
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -30,6 +30,7 @@ authors:
|
|
30
30
|
- Tim Pease
|
31
31
|
files:
|
32
32
|
- README.txt
|
33
|
+
- bin/turn
|
33
34
|
- lib/turn.rb
|
34
35
|
test_files: []
|
35
36
|
|
@@ -37,8 +38,8 @@ rdoc_options: []
|
|
37
38
|
|
38
39
|
extra_rdoc_files: []
|
39
40
|
|
40
|
-
executables:
|
41
|
-
|
41
|
+
executables:
|
42
|
+
- turn
|
42
43
|
extensions: []
|
43
44
|
|
44
45
|
requirements: []
|