summaryrefslogtreecommitdiffhomepage
path: root/test/t/exception.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/exception.rb')
-rw-r--r--test/t/exception.rb47
1 files changed, 41 insertions, 6 deletions
diff --git a/test/t/exception.rb b/test/t/exception.rb
index d27813028..742f4a044 100644
--- a/test/t/exception.rb
+++ b/test/t/exception.rb
@@ -373,12 +373,47 @@ assert('Raise in ensure') do
end
end
-assert('Raise in rescue') do
- assert_raise(ArgumentError) do
- begin
- raise "" # RuntimeError
- rescue
- raise ArgumentError
+def backtrace_avaialble?
+ begin
+ raise "XXX"
+ rescue => exception
+ not exception.backtrace.empty?
+ end
+end
+
+assert('GC in rescue') do
+ skip "backtrace isn't avaialble" unless backtrace_avaialble?
+
+ line = nil
+ begin
+ [1].each do
+ [2].each do
+ [3].each do
+ line = __LINE__; raise "XXX"
+ end
+ end
+ end
+ rescue => exception
+ GC.start
+ assert_equal("#{__FILE__}:#{line}:in Object.call",
+ exception.backtrace.first)
+ end
+end
+
+assert('Method call in rescue') do
+ skip "backtrace isn't avaialble" unless backtrace_avaialble?
+
+ line = nil
+ begin
+ [1].each do
+ [2].each do
+ line = __LINE__; raise "XXX"
+ end
+ end
+ rescue => exception
+ [3].each do
end
+ assert_equal("#{__FILE__}:#{line}:in Object.call",
+ exception.backtrace.first)
end
end