diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-01 18:41:23 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-12-01 18:41:23 +0900 |
| commit | 4d807fc619e7feccd2bc079ef76a9e817e36fa59 (patch) | |
| tree | d8f939ff77ceaa32cba522885530ef8fd22daa8e /test/t/syntax.rb | |
| parent | ab4ab7c8a0e5226e4a76f7c37bdb79d2c92c004f (diff) | |
| parent | 3f83ec64a82410cdc16863f8242eaea30dec026f (diff) | |
| download | mruby-4d807fc619e7feccd2bc079ef76a9e817e36fa59.tar.gz mruby-4d807fc619e7feccd2bc079ef76a9e817e36fa59.zip | |
Merge pull request #3313 from yhara/add-test
Add test for recently fixed bugs
Diffstat (limited to 'test/t/syntax.rb')
| -rw-r--r-- | test/t/syntax.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb index 3bc68484b..461f5430b 100644 --- a/test/t/syntax.rb +++ b/test/t/syntax.rb @@ -47,6 +47,19 @@ assert('yield', '11.3.5') do end end +assert('redo in a for loop (#3275)') do + sum = 0 + for i in 1..10 + sum += i + i -= 1 + if i > 0 + redo + end + end + + assert_equal 220, sum +end + assert('Abbreviated variable assignment', '11.4.2.3.2') do a ||= 1 b &&= 1 @@ -255,6 +268,13 @@ assert('multiple assignment (nosplat array rhs)') do assert_equal 2, g end +assert('multiple assignment (empty array rhs #3236, #3239)') do + a,b,*c = []; assert_equal [nil, nil, []], [a, b, c] + a,b,*c = [1]; assert_equal [1, nil, []], [a, b, c] + a,b,*c = [nil]; assert_equal [nil,nil, []], [a, b, c] + a,b,*c = [[]]; assert_equal [[], nil, []], [a, b, c] +end + assert('Return values of case statements') do a = [] << case 1 when 3 then 2 |
