X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/62189f57e66400fcd1135bfaf6ca2eeb2d233e15..784f6ccc15461a942888c3fe331f5e0dd3f0a9a0:/spec/indent/indent_spec.rb?ds=inline diff --git a/spec/indent/indent_spec.rb b/spec/indent/indent_spec.rb index 4227b3f..2ff0caf 100644 --- a/spec/indent/indent_spec.rb +++ b/spec/indent/indent_spec.rb @@ -205,14 +205,14 @@ shared_examples_for "vim" do describe "when using a function definition" do it "indents shiftwidth spaces" do vim.feedkeys 'idef long_function_name(\arg' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end describe "when using a class definition" do it "indents shiftwidth spaces" do vim.feedkeys 'iclass Foo(\' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end @@ -430,7 +430,7 @@ shared_examples_for "vim" do it "ignores the call signature after a function" do vim.feedkeys 'idef f( JEDI_CALL_SIGNATURE\' - indent.should == shiftwidth * 2 + indent.should == shiftwidth end end end @@ -702,7 +702,10 @@ describe "Compact multiline dict" do end describe "Using O" do - before { vim.feedkeys 'iif foo:\' } + before { + vim.feedkeys '\ggdG' + vim.feedkeys 'iif foo:\' + } it "respects autoindent" do vim.feedkeys '1\\' @@ -727,3 +730,32 @@ describe "searchpairpos" do indent.should == shiftwidth end end + +describe "o within TODO" do + before { + vim.feedkeys '\ggdG' + vim.feedkeys 'iif 1: # TODO\' + # Assertion that we have a pythonTodo here. + vim.echo('synIDattr(synID(line("."), col("."), 0), "name")').should match 'pythonTodo' + } + + it "respects autoindent" do + vim.feedkeys 'o' + indent.should == shiftwidth + end +end + +describe "elif after else" do + before { + vim.feedkeys '\ggdG' + } + + it "is indented to the outer if" do + vim.feedkeys 'iif 1:\if 2:\pass\else:\pass\elif 3:\' + indent.should == 0 + + vim.feedkeys '\ggdG' + vim.feedkeys 'i if 1:\if 2:\pass\else:\pass\elif 3:\' + indent.should == 4 + end +end