1" Tests for smartindent 2 3" Tests for not doing smart indenting when it isn't set. 4function! Test_nosmartindent() 5 new 6 call append(0, [" some test text", 7 \ " test text", 8 \ "test text", 9 \ " test text"]) 10 set nocindent nosmartindent autoindent 11 exe "normal! gg/some\<CR>" 12 exe "normal! 2cc#test\<Esc>" 13 call assert_equal(" #test", getline(1)) 14 enew! | close 15endfunction 16 17function MyIndent() 18endfunction 19 20" When 'indentexpr' is set, setting 'si' has no effect. 21function Test_smartindent_has_no_effect() 22 new 23 exe "normal! i\<Tab>one\<Esc>" 24 set noautoindent 25 set smartindent 26 set indentexpr= 27 exe "normal! Gotwo\<Esc>" 28 call assert_equal("\ttwo", getline("$")) 29 30 set indentexpr=MyIndent 31 exe "normal! Gothree\<Esc>" 32 call assert_equal("three", getline("$")) 33 34 delfunction! MyIndent 35 set autoindent& 36 set smartindent& 37 set indentexpr& 38 bwipe! 39endfunction 40 41" vim: shiftwidth=2 sts=2 expandtab 42