diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 04:52:56 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 04:52:56 +0000 |
commit | fe898043ccc99f3e127c63e0c18f4d2233bfa555 (patch) | |
tree | e3365ee32256f9d0be33e7093e418f7be34e5fc7 /bootstraptest/test_block.rb | |
parent | 4edc1d8c9c234303096e6e5a35e87944b50d247d (diff) |
* parse.y: fix rules around f_margs. "make test" passes all tests.
* bootstraptest/test_block.rb: add some tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_block.rb')
-rw-r--r-- | bootstraptest/test_block.rb | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb index 96d78cc965..747a48fdaa 100644 --- a/bootstraptest/test_block.rb +++ b/bootstraptest/test_block.rb @@ -336,7 +336,6 @@ assert_equal %q{[1, nil]}, %q{ } } -# block parameter (shouldn't SEGV: [ruby-dev:31143]) assert_equal '0', %q{ def m() end @@ -364,31 +363,28 @@ m {|(v0,*v1,v2),*,v3,&v4|} m {|(v0, *v1, v2)|} m {|(*,v)|} 0 -} +}, "block parameter (shouldn't SEGV: [ruby-dev:31143])" -# [ruby-dev:31147] assert_equal 'nil', %q{ def m yield end m{|&b| b}.inspect -} +}, '[ruby-dev:31147]' -# [ruby-dev:31160] assert_equal 'nil', %q{ def m() yield end m {|(v,(*))|}.inspect -} +}, '[ruby-dev:31160]' -# [ruby-dev:31153] assert_equal 'nil', %q{ def m() yield end m {|(*,a,b)|}.inspect -} +}, '[ruby-dev:31153]' assert_equal 'nil', %q{ def m() @@ -397,3 +393,20 @@ assert_equal 'nil', %q{ m {|((*))|}.inspect } +assert_equal %q{[1, 1, [1, nil], [1, nil], [1, nil], [1, nil], [1, 1], 1, [1, nil], [1, nil], [1, nil], [1, nil], [[1, 1], [1, 1]], [1, 1], [1, 1], [1, 1], [1, nil], [1, nil], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [1, 1], [1, 1], [[[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[1, 1], [1, 1]], [[1, 1], [1, 1]]]}, %q{ +def m(ary = []) + yield(ary) +end + +$ans = [] +o = 1 +5.times{ + v,(*) = o; $ans << o + m(o){|(v,(*))| $ans << v} + ((x, y)) = o; $ans << [x, y] + m(o){|((x, y))| $ans << [x, y]} + (((x, y))) = o; $ans << [x, y] + m(o){|(((x, y)))| $ans << [x, y]} + o = [o, o] +}; $ans +} |