summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-03 16:00:34 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-03 16:00:34 +0000
commit91b51140d7f2b79f8fb7d0ea8901de89fa0304d6 (patch)
treef6bf28a6603ef69e17ec1209788fb17de851693c /test
parentb17da781050f2bd464b7dbff759783e04428f4b4 (diff)
merge revision(s) 59183,59184: [Backport #13682]
fix return in toplevel rescue/ensure * compile.c (iseq_compile_each0): throw TAG_RETURN at return in toplevel rescue/ensure to adjust VM stack properly. [ruby-core:81777] [Bug #13682] * vm_insnhelper.c (vm_throw_start): allow return in toplevel rescue/ensure. fix return in toplevel ensure * compile.c (iseq_compile_each0): adjust stack after return in toplevel ensure, when the value is used. [ruby-core:81777] [Bug #13682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_eval.rb10
-rw-r--r--test/ruby/test_syntax.rb2
2 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index fc08d61ef5..a2029bb9b5 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -525,4 +525,14 @@ class TestEval < Test::Unit::TestCase
b.eval('yield')
}, '[Bug #10368]'
end
+
+ def test_return_in_eval_proc
+ x = proc {eval("return :ng")}
+ assert_raise(LocalJumpError) {x.call}
+ end
+
+ def test_return_in_eval_lambda
+ x = lambda {eval("return :ok")}
+ assert_equal(:ok, x.call)
+ end
end
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 251da58297..9838680e6a 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -984,6 +984,8 @@ eom
return 1; raise
"#{return}"
raise((return; "should not raise"))
+ begin raise; ensure return; end; self
+ begin raise; ensure return; end and self
end;
all_assertions(feature4840) do |a|
code.each_line do |s|