summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_cindent.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_cindent.vim')
-rw-r--r--src/testdir/test_cindent.vim24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index d352e8feff..7c2c5e341c 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -71,7 +71,7 @@ func Test_cino_extern_c()
bwipe!
endfunc
-func! Test_cindent_rawstring()
+func Test_cindent_rawstring()
new
setl cindent
call feedkeys("i" .
@@ -81,5 +81,25 @@ func! Test_cindent_rawstring()
\ "statement;\<Esc>", "x")
call assert_equal("\tstatement;", getline(line('.')))
bw!
-endfunction
+endfunc
+
+func Test_cindent_expr()
+ new
+ func! MyIndentFunction()
+ return v:lnum == 1 ? shiftwidth() : 0
+ endfunc
+ setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction()
+ call setline(1, ['var_a = something()', 'b = something()'])
+ call cursor(1, 1)
+ call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
+ call assert_equal([' var_a = something();', 'b = something();'], getline(1, '$'))
+
+ %d
+ call setline(1, [' var_a = something()', ' b = something()'])
+ call cursor(1, 1)
+ call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
+ call assert_equal([' var_a = something();', ' b = something()'], getline(1, '$'))
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab