summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2024-01-30 17:41:31 +0900
committerNARUSE, Yui <naruse@airemix.jp>2024-01-30 17:41:31 +0900
commitd4b780e84e9a6b858d0f6c6a44b22da0d2f5835e (patch)
tree03377b9fcdbe644f72c21bd2454460a3e55d350b /test/ruby
parent5f3dfa1c273c6fb9eae65ceca633b46f7e30f686 (diff)
merge revision(s) bc002971b6ad483dbf69b8a275c44412bb6ab954: [Backport #20094]
[Bug #20094] Distinguish `begin` and parentheses --- compile.c | 1 + parse.y | 36 +++++++++++++++++++++--------------- test/ruby/test_whileuntil.rb | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 15 deletions(-)
Diffstat (limited to 'test/ruby')
-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