summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-04-04 23:36:51 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-04-04 23:36:51 +0000
commit8bfee861356c8402f11e6979bf57e25c18dd2a12 (patch)
treed08ac457babe19c158ae7a39514f01e5707cf545 /test
parentc08edc4eeffa3590b6853b882ce211bb6bca5f8d (diff)
merge revision(s) ce7a053475cbebfb2f3e5ed6614e0ba631541917,1cbb1f1720127b0b34b38c77e27b51b182008699: [Backport #16695]
Adjust sp for `x = false; y = (return until x unless x)` [Bug #16695] test/ruby/test_syntax.rb: avoid "warning: assigned but unused variable" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 3e77f44efe..ab462bddf4 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1265,6 +1265,15 @@ eom
assert_nil obj.test
end
+ def test_assignment_return_in_loop
+ obj = Object.new
+ def obj.test
+ x = nil
+ _y = (return until x unless x)
+ end
+ assert_nil obj.test, "[Bug #16695]"
+ end
+
def test_method_call_location
line = __LINE__+5
e = assert_raise(NoMethodError) do