Permalink
Browse files

+ Change error output to match Class#method, making it easier to use …

…-n filter.

[git-p4: depot-paths = "//src/minitest/dev/": change = 8279]
  • Loading branch information...
zenspider committed Feb 28, 2013
1 parent f098df8 commit 12007fff8ca1f0cc76b44a9052df21eadb9529e8
Showing with 11 additions and 11 deletions.
  1. +3 −3 lib/minitest/unit.rb
  2. +8 −8 test/minitest/test_minitest_unit.rb
View
@@ -959,14 +959,14 @@ def puke klass, meth, e
when MiniTest::Skip then
@skips += 1
return "S" unless @verbose
- "Skipped:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
+ "Skipped:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n"
when MiniTest::Assertion then
@failures += 1
- "Failure:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
+ "Failure:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n"
else
@errors += 1
bt = MiniTest::filter_backtrace(e.backtrace).join "\n "
- "Error:\n#{meth}(#{klass}):\n#{e.class}: #{e.message}\n #{bt}\n"
+ "Error:\n#{klass}##{meth}:\n#{e.class}: #{e.message}\n #{bt}\n"
end
@report << e
e[0, 1]
@@ -23,7 +23,7 @@ def test_class_puke_with_assertion_failed
assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("method_name(SomeClass) [unhappy]", @tu.report.first)
+ assert_match("SomeClass#method_name [unhappy]", @tu.report.first)
end
def test_class_puke_with_assertion_failed_and_long_backtrace
@@ -43,7 +43,7 @@ def test_class_puke_with_assertion_failed_and_long_backtrace
assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("test_method_name(TestSomeClass) [#{ex_location}]", @tu.report.first)
+ assert_match("TestSomeClass#test_method_name [#{ex_location}]", @tu.report.first)
end
def test_class_puke_with_assertion_failed_and_user_defined_assertions
@@ -66,7 +66,7 @@ def test_class_puke_with_assertion_failed_and_user_defined_assertions
assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("test_method_name(TestSomeClass) [#{ex_location}]", @tu.report.first)
+ assert_match("TestSomeClass#test_method_name [#{ex_location}]", @tu.report.first)
end
def test_class_puke_with_failure_and_flunk_in_backtrace
@@ -99,7 +99,7 @@ def test_class_puke_with_flunk_and_user_defined_assertions
assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("test_method_name(TestSomeClass) [#{ex_location}]", @tu.report.first)
+ assert_match("TestSomeClass#test_method_name [#{ex_location}]", @tu.report.first)
end
def test_class_puke_with_non_failure_exception
@@ -287,7 +287,7 @@ def test_error
Finished tests in 0.00
1) Error:
- test_error(#<Class:0xXXX>):
+ #<Class:0xXXX>#test_error:
RuntimeError: unhandled exception
FILE:LINE:in \`test_error\'
@@ -314,7 +314,7 @@ def teardown
Finished tests in 0.00
1) Error:
- test_something(#<Class:0xXXX>):
+ #<Class:0xXXX>#test_something:
RuntimeError: unhandled exception
FILE:LINE:in \`teardown\'
@@ -341,7 +341,7 @@ def test_failure
Finished tests in 0.00
1) Failure:
- test_failure(#<Class:0xXXX>) [FILE:LINE]:
+ #<Class:0xXXX>#test_failure [FILE:LINE]:
Failed assertion, no message given.
2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
@@ -490,7 +490,7 @@ def test_skip
Finished tests in 0.00
1) Skipped:
- test_skip(#<Class:0xXXX>) [FILE:LINE]:
+ #<Class:0xXXX>#test_skip [FILE:LINE]:
not yet
2 tests, 1 assertions, 0 failures, 0 errors, 1 skips

0 comments on commit 12007ff

Please sign in to comment.