summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-12-29 23:49:33 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-12-29 23:49:33 +0900
commitee3fa1be49e4d48acd7fdd6bd049a8d5d4d4724c (patch)
tree49015de74ab4953c278e59dd9299858d46979f10 /test
parente132de9e8eaf095f6f8b826e34a1c145403c3311 (diff)
parent0ebac02813d6506f92c9aaceaa00c6f902a56a03 (diff)
downloadmruby-ee3fa1be49e4d48acd7fdd6bd049a8d5d4d4724c.tar.gz
mruby-ee3fa1be49e4d48acd7fdd6bd049a8d5d4d4724c.zip
Merge pull request #3065 from kou/support-backtrace-after-method-calls
Support backtrace after method calls
Diffstat (limited to 'test')
-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