diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-08 17:09:59 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-08 17:09:59 +0900 |
commit | 995ae6d529d6bef62ca756d4b1dbc1e01f062b8a (patch) | |
tree | 85ff53540c962103d5167691582679a0e01b084b /test/ruby/test_rubyoptions.rb | |
parent | e0a3c547dd2690e5bfa4a03f59aed5315d926a82 (diff) | |
download | ruby-995ae6d529d6bef62ca756d4b1dbc1e01f062b8a.tar.gz |
Check indent of `end` against `else` if present
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index d63ca5da4d..0d22ba21ef 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -492,6 +492,7 @@ class TestRubyOptions < Test::Unit::TestCase [" case nil", "when true; end"], ["case nil; when true", "end"], ["if false;", "end", "if true\nelse ", "end"], + ["else", " end", "_ = if true\n"], ].each do |b, e = 'end', pre = nil, post = nil| src = ["#{pre}#{b}\n", " #{e}\n#{post}"] @@ -500,7 +501,7 @@ class TestRubyOptions < Test::Unit::TestCase n = 2 n += pre.count("\n") if pre - a.for("no directives with #{b}") do + a.for("no directives with #{src}") do err = ["#{t.path}:#{n}: warning: mismatched indentations at '#{e}' with '#{k}' at #{n-1}"] t.rewind t.truncate(0) @@ -510,7 +511,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err) end - a.for("false directive with #{b}") do + a.for("false directive with #{src}") do t.rewind t.truncate(0) t.puts "# -*- warn-indent: false -*-" @@ -519,7 +520,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]') end - a.for("false and true directives with #{b}") do + a.for("false and true directives with #{src}") do err = ["#{t.path}:#{n+2}: warning: mismatched indentations at '#{e}' with '#{k}' at #{n+1}"] t.rewind t.truncate(0) @@ -530,7 +531,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(["-w", t.path], "", [], err, '[ruby-core:25442]') end - a.for("false directives after #{b}") do + a.for("false directives after #{src}") do t.rewind t.truncate(0) t.puts "# -*- warn-indent: true -*-" @@ -541,7 +542,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]') end - a.for("BOM with #{b}") do + a.for("BOM with #{src}") do err = ["#{t.path}:#{n}: warning: mismatched indentations at '#{e}' with '#{k}' at #{n-1}"] t.rewind t.truncate(0) |