diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-27 06:57:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-27 06:57:34 +0000 |
commit | a42be1e048e9dc7eb5e0453beea678dea95e5194 (patch) | |
tree | 7c657a90b1ea8f6f7fd830a695d9332cedce2d98 /test/ruby/test_eval.rb | |
parent | adeb6795e9e6334760d77b510ec52b28b0a35280 (diff) | |
download | ruby-a42be1e048e9dc7eb5e0453beea678dea95e5194.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_eval.rb')
-rw-r--r-- | test/ruby/test_eval.rb | 10 |
1 files changed, 10 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 |