diff options
author | ntalbott <ntalbott@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-02 23:03:13 +0000 |
---|---|---|
committer | ntalbott <ntalbott@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-02 23:03:13 +0000 |
commit | 47bd3ed9ce1bfe9116925b95f4c2b342e864af5a (patch) | |
tree | d0b9e0216e099df5b9f77378956d50c59a7cc320 /lib/test/unit/testcase.rb | |
parent | 56db4c8fb04617549c4b1c3aee3a39b3a4adada9 (diff) | |
download | ruby-47bd3ed9ce1bfe9116925b95f4c2b342e864af5a.tar.gz |
* lib/test/unit/assertions.rb: added a default message for #assert,
#assert_block, and #flunk.
* test/testunit/test_assertions.rb: ditto.
* lib/test/unit/failure.rb: failures now show a better trace of where
they occurred.
* test/testunit/test_failure.rb: ditto (added).
* lib/test/unit/testcase.rb: ditto.
* test/testunit/test_testcase.rb: ditto.
* lib/test/unit/util/backtracefilter.rb: added.
* test/testunit/util/test_backtracefilter.rb: added.
* lib/test/unit/error.rb: changed to use BacktraceFilter and improved
output.
* test/testunit/test_error.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit/testcase.rb')
-rw-r--r-- | lib/test/unit/testcase.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/test/unit/testcase.rb b/lib/test/unit/testcase.rb index c831b764a5..f258c23ca1 100644 --- a/lib/test/unit/testcase.rb +++ b/lib/test/unit/testcase.rb @@ -9,6 +9,7 @@ require 'test/unit/failure' require 'test/unit/error' require 'test/unit/testsuite' require 'test/unit/assertionfailederror' +require 'test/unit/util/backtracefilter' module Test module Unit @@ -20,6 +21,7 @@ module Test # collecting its results into a Test::Unit::TestResult object. class TestCase include Assertions + include Util::BacktraceFilter attr_reader :method_name @@ -116,18 +118,7 @@ module Test def add_failure(message, all_locations=caller()) # :nodoc: @test_passed = false - assertions_pattern = /[^A-Za-z_]assertions\.rb:/ - if (all_locations.detect { |entry| entry =~ assertions_pattern }) - all_locations.shift - until (all_locations[0] =~ assertions_pattern || all_locations.empty?) - all_locations.shift - end - location = all_locations.detect { |entry| entry !~ assertions_pattern } - else - location = all_locations[0] - end - location = location[/^.+:\d+/] - @_result.add_failure(Failure.new("#{name} [#{location}]", message)) + @_result.add_failure(Failure.new(name, filter_backtrace(all_locations), message)) end private :add_failure |