summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 06:37:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 06:37:46 +0000
commitbf87ec4eb9927930d18b91220bddbe2b1a5f9cd4 (patch)
tree4af191b10aef043a327bcee94f3ea0963b4006a7 /test/ruby
parentb30c4aa8d7e1781b71ec0a9fa4826d58030101f9 (diff)
* parse.y (parser_yylex): fix warning line number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 5ede83caba..6f51497cf2 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require_relative 'envutil'
class TestSyntax < Test::Unit::TestCase
def assert_valid_syntax(code, fname, mesg = fname)
@@ -8,6 +9,7 @@ class TestSyntax < Test::Unit::TestCase
}
code.force_encoding("us-ascii")
verbose, $VERBOSE = $VERBOSE, nil
+ yield if defined?(yield)
assert_nothing_raised(SyntaxError, mesg) do
assert_equal(:ok, catch {|tag| eval(code, binding, fname, 0)}, mesg)
end
@@ -88,6 +90,12 @@ class TestSyntax < Test::Unit::TestCase
assert_equal({foo: 1, bar: 2}, o.kw(foo: 1, bar: 2))
end
+ def test_warn_grouped_expression
+ assert_warn("test:2: warning: (...) interpreted as grouped expression\n") do
+ assert_valid_syntax("foo \\\n(\n true)", "test") {$VERBOSE = true}
+ end
+ end
+
private
def make_tmpsrc(f, src)