From: Hynek Schlawack Date: Sat, 9 Nov 2013 15:08:57 +0000 (-0800) Subject: Merge pull request #19 from kljohann/tests X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/b0bb7f66733400fe8ac914fab8860aec8d38b915?ds=inline;hp=-c Merge pull request #19 from kljohann/tests Run test cases for different sets of settings While we care only about 4 spaces, running it with both may uncover subtle bugs. --- b0bb7f66733400fe8ac914fab8860aec8d38b915 diff --combined spec/indent/indent_spec.rb index 21d14b7,bd0d0d9..eb3c8a6 --- a/spec/indent/indent_spec.rb +++ b/spec/indent/indent_spec.rb @@@ -1,6 -1,6 +1,6 @@@ require "spec_helper" - describe "vim" do + shared_examples_for "vim" do before(:each) { vim.normal 'gg"_dG' } # clear buffer @@@ -67,20 -67,6 +67,20 @@@ end end + describe "when '#' is contained in a string that is followed by a colon" do + it "indents by one level" do + vim.feedkeys 'iif "some#thing" == "test":#test\pass' + indent.should == shiftwidth + end + end + + describe "when '#' is not contained in a string and is followed by a colon" do + it "does not indent" do + vim.feedkeys 'iif "some#thing" == "test"#:test\' + indent.should == 0 + end + end + describe "when using simple control structures" do it "indents shiftwidth spaces" do vim.feedkeys 'iwhile True:\pass' @@@ -100,7 -86,7 +100,7 @@@ end it "indents relative to line above" do - vim.feedkeys 'i\tvalue = test + \\\\\' + vim.feedkeys 'i\value = test + \\\\\' indent.should == shiftwidth * 2 end end @@@ -145,3 -131,18 +145,18 @@@ 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 + + describe "vim when using width of 8" do + before { + vim.command("set sw=8 ts=8 sts=8 et") + } + + it_behaves_like "vim" + end