summaryrefslogtreecommitdiffstats
path: root/test/testunit/test_error.rb
diff options
context:
space:
mode:
authorntalbott <ntalbott@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-02 23:03:13 +0000
committerntalbott <ntalbott@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-02 23:03:13 +0000
commitdc65dd6543a0970c1d3e5f5de845878631ff7f1d (patch)
treed0b9e0216e099df5b9f77378956d50c59a7cc320 /test/testunit/test_error.rb
parent01853231895005d55c05d78bb0efdc7f212d23dc (diff)
downloadruby-dc65dd6543a0970c1d3e5f5de845878631ff7f1d.tar.gz
ruby-dc65dd6543a0970c1d3e5f5de845878631ff7f1d.tar.xz
ruby-dc65dd6543a0970c1d3e5f5de845878631ff7f1d.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@4657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/testunit/test_error.rb')
-rw-r--r--test/testunit/test_error.rb32
1 files changed, 14 insertions, 18 deletions
diff --git a/test/testunit/test_error.rb b/test/testunit/test_error.rb
index c95bef38c..56b275b36 100644
--- a/test/testunit/test_error.rb
+++ b/test/testunit/test_error.rb
@@ -2,28 +2,24 @@
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license.
-require 'test/unit/error'
+require 'test/unit'
module Test
module Unit
class TC_Error < TestCase
- def setup
- @old_load_path = $:.dup
- $:.replace(['C:\some\old\path'])
- end
-
- def test_backtrace_filtering
- backtrace = [%q{tc_thing.rb:4:in '/'}]
-
- backtrace.concat([%q{tc_thing.rb:4:in 'test_stuff'},
- %q{C:\some\old\path/test/unit/testcase.rb:44:in 'send'},
- %q{C:\some\old\path\test\unit\testcase.rb:44:in 'run'},
- %q{tc_thing.rb:3}])
- assert_equal([backtrace[0..1], backtrace[-1]].flatten, Error.filter(backtrace), "Should filter out all TestUnit-specific lines")
- end
-
- def teardown
- $:.replace(@old_load_path)
+ TF_Exception = Struct.new('TF_Exception', :message, :backtrace)
+ def test_display
+ ex = TF_Exception.new("message1\nmessage2", ['line1', 'line2'])
+ e = Error.new("name", ex)
+ assert_equal("name: #{TF_Exception.name}: message1", e.short_display)
+ assert_equal(<<EOM.strip, e.long_display)
+Error:
+name:
+Struct::TF_Exception: message1
+message2
+ line1
+ line2
+EOM
end
end
end