X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5f4184fb1200b329e810c1e4c866c86fdf44c135..19c53ee5f8b6e9054d0ee1c295d876ccb96a21f7:/spec/indent/indent_spec.rb diff --git a/spec/indent/indent_spec.rb b/spec/indent/indent_spec.rb index 6e5a79f..79d7f84 100644 --- a/spec/indent/indent_spec.rb +++ b/spec/indent/indent_spec.rb @@ -52,7 +52,7 @@ shared_examples_for "vim" do it "puts the closing parenthesis at the same level" do vim.feedkeys ')' - indent.should == 0 + indent.should == (hang_closing ? shiftwidth : 0) end end @@ -87,7 +87,7 @@ shared_examples_for "vim" do it "lines up the closing parenthesis" do vim.feedkeys '}' - indent.should == 0 + indent.should == (hang_closing ? shiftwidth : 0) end end @@ -514,18 +514,31 @@ shared_examples_for "multiline strings" do end end -describe "vim when using width of 4" do - before { - vim.command("set sw=4 ts=4 sts=4 et") - } - it_behaves_like "vim" -end +SUITE_SHIFTWIDTHS = [4, 3] +SUITE_HANG_CLOSINGS = [nil, false, true] -describe "vim when using width of 3" do - before { - vim.command("set sw=3 ts=3 sts=3 et") - } - it_behaves_like "vim" +SUITE_SHIFTWIDTHS.each do |sw| + describe "vim when using width of #{sw}" do + before { + vim.command("set sw=#{sw} ts=#{sw} sts=#{sw} et") + } + it "sets shiftwidth to #{sw}" do + shiftwidth.should == sw + end + + SUITE_HANG_CLOSINGS.each do |hc| + describe "vim when hang_closing is set to #{hc}" do + before { + set_hang_closing hc + } + it "sets hang_closing to #{hc}" do + hang_closing.should == !!hc + end + + it_behaves_like "vim" + end + end + end end describe "vim when not using python_pep8_indent_multiline_string" do