diff options
Diffstat (limited to 'test/ruby/test_syntax.rb')
-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) |