summaryrefslogtreecommitdiff
path: root/test/testunit/test_error.rb
diff options
context:
space:
mode:
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 c95bef38c4..56b275b362 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