summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-14 07:49:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-14 07:49:06 +0000
commitb5c3fb246579d99d3f7316477f12580963cd9cf8 (patch)
tree9a1442a152484dbf25844a68049b2d26c002509e /test/ruby
parentf2dd4eb3cc32b5edd4f6cbff34b922f662300ea5 (diff)
* parse.y (parser_set_token_info): turn on/off with directives.
[ruby-core:25442] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_rubyoptions.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 169f12f590..e47060f354 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -313,6 +313,31 @@ class TestRubyOptions < Test::Unit::TestCase
err = ["#{t.path}:2: warning: mismatched indentations at 'end' with 'begin' at 1"]
assert_in_out_err(["-w", t.path], "", [], err)
assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err)
+
+ t.open
+ t.puts "# -*- warn-indent: false -*-"
+ t.puts "begin"
+ t.puts " end"
+ t.close
+ assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]')
+
+ err = ["#{t.path}:4: warning: mismatched indentations at 'end' with 'begin' at 3"]
+ t.open
+ t.puts "# -*- warn-indent: false -*-"
+ t.puts "# -*- warn-indent: true -*-"
+ t.puts "begin"
+ t.puts " end"
+ t.close
+ assert_in_out_err(["-w", t.path], "", [], err, '[ruby-core:25442]')
+
+ err = ["#{t.path}:4: warning: mismatched indentations at 'end' with 'begin' at 2"]
+ t.open
+ t.puts "# -*- warn-indent: true -*-"
+ t.puts "begin"
+ t.puts "# -*- warn-indent: false -*-"
+ t.puts " end"
+ t.close
+ assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]')
ensure
t.close(true) if t
end