diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-05 16:34:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-05 16:34:21 +0000 |
commit | c46bdadb84bec5fd4484e4375e2935d740984618 (patch) | |
tree | e2293bd39003a28ae4ce9fcee1fa9b6de9896e82 /test | |
parent | 45f3651d1c0fbc286a3083eb03624fc9bc696232 (diff) | |
download | ruby-c46bdadb84bec5fd4484e4375e2935d740984618.tar.gz |
* parse.y (block_call): rules for block_call after block_call.
based on a patch by pasberth https://github.com/ruby/ruby/pull/102
[ruby-dev:45308][Bug #6115]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index fde8dca308..f247b4c6dc 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -63,6 +63,20 @@ class TestSyntax < Test::Unit::TestCase end end + tap do |_, + bug6115 = '[ruby-dev:45308]', + blockcall = '["elem"].each_with_object [] do end', + methods = [['map', 'no'], ['inject([])', 'with']], + blocks = [['do end', 'do'], ['{}', 'brace']], + *| + [%w'. dot', %w':: colon'].product(methods, blocks) do |(c, n1), (m, n2), (b, n3)| + m = m.tr_s('()', ' ').strip if n2 == 'do' + name = "test_#{n3}_block_after_blockcall_#{n1}_#{n2}_arg" + code = "#{blockcall}#{c}#{m} #{b}" + define_method(name) {assert_valid_syntax(code, bug6115)} + end + end + private def make_tmpsrc(f, src) |