diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-21 20:30:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-21 20:30:53 +0000 |
commit | 9150340b9bcbe305c2647a8d6f6f8e754769f3e7 (patch) | |
tree | 7b3bcd76d27cb024d578dd177521594f8cbaf59c /test | |
parent | 79f7dfabb69ec435b6b0be5ccb5157cb85e71580 (diff) |
parse.y: refine warning message
* parse.y (ambiguous_operator): refine warning message, since this
warning is shown after literal too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index bc29007359..823b64692c 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -111,6 +111,27 @@ class TestSyntax < Test::Unit::TestCase end end + def test_warn_balanced + warning = <<WARN +test:1: warning: `%s' after local variable or literal is interpreted as binary operator +test:1: warning: even though it seems like %s +WARN + [ + [:**, "argument prefix"], + [:*, "argument prefix"], + [:<<, "here document"], + [:&, "argument prefix"], + [:+, "unary operator"], + [:-, "unary operator"], + [:/, "regexp literal"], + [:%, "string literal"], + ].each do |op, syn| + assert_warning(warning % [op, syn]) do + assert_valid_syntax("puts 1 #{op}0", "test") {$VERBOSE = true} + end + end + end + def test_cmd_symbol_after_keyword bug6347 = '[ruby-dev:45563]' assert_not_label(:foo, 'if true then not_label:foo end', bug6347) |