diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-10 08:26:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-10 08:26:46 +0000 |
commit | 53d6cda30ce300670e34fc076e84afbed64f266b (patch) | |
tree | dd9965e0b388eccaa5873c988462c8fac3a09033 /test | |
parent | a550ff57cae8d8ba423325593915b238cc941c18 (diff) | |
download | ruby-53d6cda30ce300670e34fc076e84afbed64f266b.tar.gz |
parse.y: rescue modifier in rhs
* parse.y (command_asgn): rescue modifier in command assignment
should be limited to rhs only. [ruby-core:75621] [Bug #12402]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_parse.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index eca1744b96..7f0177819e 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -874,6 +874,16 @@ x = __ENCODING__ assert_warning('') {eval("#{a} = 1; /(?<#{a}>)/ =~ ''")} end + def test_rescue_in_command_assignment + bug = '[ruby-core:75621] [Bug #12402]' + v = bug + v = raise(v) rescue "ok" + assert_equal("ok", v) + v = bug + v = raise v rescue "ok" + assert_equal("ok", v) + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} |