diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-12-27 17:49:59 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-12-27 17:50:15 +0900 |
| commit | bc002971b6ad483dbf69b8a275c44412bb6ab954 (patch) | |
| tree | d4999fed21c0dc368d1760ba2cc6fdea7b65de40 /test/ruby | |
| parent | 15c280639e383871eb2688c4cfbbeff48a08bc72 (diff) | |
[Bug #20094] Distinguish `begin` and parentheses
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_whileuntil.rb | 18 |
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 |
