Permalink
Browse files

Fix typo in DefaultReporter.

Close #9.
  • Loading branch information...
1 parent 75eb353 commit c7a8f4a54613aed9c42da203223c278ed3e4ab46 Alexander Kern committed Jan 22, 2012
Showing with 23 additions and 23 deletions.
  1. +23 −23 lib/minitest/reporters/default_reporter.rb
View
46 lib/minitest/reporters/default_reporter.rb
@@ -3,47 +3,47 @@
module MiniTest
module Reporters
# A reporter identical to the standard MiniTest reporter.
- #
+ #
# Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
- #
+ #
# @see https://github.com/seattlerb/minitest MiniTest
class DefaultReporter
include MiniTest::Reporter
-
+
def before_suites(suites, type)
puts
puts "# Running #{type}s:"
puts
end
-
+
def before_test(suite, test)
- print "#{suite}##{method} = " if verbose?
+ print "#{suite}##{test} = " if verbose?
end
-
+
def pass(suite, test, test_runner)
after_test('.')
end
-
+
def skip(suite, test, test_runner)
after_test('S')
end
-
+
def failure(suite, test, test_runner)
after_test('F')
end
-
+
def error(suite, test, test_runner)
after_test('E')
end
-
+
def after_suites(suites, type)
time = Time.now - runner.start_time
-
+
puts
puts
puts "Finished #{type}s in %.6fs, %.4f tests/s, %.4f assertions/s." %
[time, runner.test_count / time, runner.assertion_count / time]
-
+
i = 0
runner.report.each do |suite, tests|
tests.each do |test, test_runner|
@@ -54,38 +54,38 @@ def after_suites(suites, type)
end
end
end
-
+
puts
-
+
puts status
end
-
+
private
-
+
def after_test(result)
time = Time.now - runner.test_start_time
-
+
print '%.2f s = ' % time if verbose?
print result
puts if verbose?
end
-
+
def location(exception)
last_before_assertion = ''
-
+
exception.backtrace.reverse_each do |s|
break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
last_before_assertion = s
end
-
+
last_before_assertion.sub(/:in .*$/, '')
end
-
+
def message_for(test_runner)
suite = test_runner.suite
test = test_runner.test
e = test_runner.exception
-
+
case test_runner.result
when :pass then nil
when :skip then "Skipped:\n#{test}(#{suite}) [#{location(e)}]:\n#{e.message}\n"
@@ -95,7 +95,7 @@ def message_for(test_runner)
"Error:\n#{test}(#{suite}):\n#{e.class}: #{e.message}\n #{bt}\n"
end
end
-
+
def status
'%d tests, %d assertions, %d failures, %d errors, %d skips' %
[runner.test_count, runner.assertion_count, runner.failures, runner.errors, runner.skips]

0 comments on commit c7a8f4a

Please sign in to comment.