From b5c3fb246579d99d3f7316477f12580963cd9cf8 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 14 Nov 2010 07:49:06 +0000 Subject: * 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 --- test/ruby/test_rubyoptions.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3