X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/80f44e73fdb2b71d7ef4825b609a682508b2145c..8c347a6f4591e75a16cca9350cffde5cfaefd25a:/spec/indent/indent_spec.rb?ds=sidebyside diff --git a/spec/indent/indent_spec.rb b/spec/indent/indent_spec.rb index 68b545f..641ad7e 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 @@ -700,3 +700,47 @@ describe "Compact multiline dict" do proposed_indent.should == 0 end end + +describe "Using O" do + before { + vim.feedkeys '\ggdG' + vim.feedkeys 'iif foo:\' + } + + it "respects autoindent" do + vim.feedkeys '1\\' + indent.should == shiftwidth + vim.feedkeys '\ko' + indent.should == shiftwidth + vim.feedkeys '\kO' + indent.should == shiftwidth + # Uses/keeps indent from line above + vim.feedkeys '\i2\O' + indent.should == shiftwidth + # Uses/keeps indent from line above + vim.feedkeys '\j\O' + indent.should == 0 + end +end + +describe "searchpairpos" do + before { vim.feedkeys '\ggdG' } + it "handles nested parenthesis" do + vim.feedkeys 'iif foo.startswith("("):\' + 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