summaryrefslogtreecommitdiff
path: root/test/ruby/test_whileuntil.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2024-05-29 16:34:43 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2024-05-29 16:35:18 -0700
commit0044b6aefc656874adb9266829f19870dcd3d75e (patch)
tree10b43b917753e1d5df15c4d642431b24cbad6dbd /test/ruby/test_whileuntil.rb
parentb3f2ccea5efb060e99d289b2272ddfe413e4f051 (diff)
merge revision(s) bc002971b6ad483dbf69b8a275c44412bb6ab954: [Backport #20094]
[Bug #20094] Distinguish `begin` and parentheses
Diffstat (limited to 'test/ruby/test_whileuntil.rb')
-rw-r--r--test/ruby/test_whileuntil.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_whileuntil.rb b/test/ruby/test_whileuntil.rb
index 121c44817d..ff6d29ac4a 100644
--- a/test/ruby/test_whileuntil.rb
+++ b/test/ruby/test_whileuntil.rb
@@ -73,6 +73,24 @@ class TestWhileuntil < Test::Unit::TestCase
}
end
+ def test_begin_while
+ i = 0
+ sum = 0
+ begin
+ i += 1
+ sum += i
+ end while i < 10
+ assert_equal([10, 55], [i, sum])
+
+ i = 0
+ sum = 0
+ (
+ i += 1
+ sum += i
+ ) while false
+ assert_equal([0, 0], [i, sum])
+ end
+
def test_until
i = 0
until i>4