diff options
Diffstat (limited to 'src/nvim/testdir/test_cindent.vim')
-rw-r--r-- | src/nvim/testdir/test_cindent.vim | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim index 7c2c5e341c..debc9da46d 100644 --- a/src/nvim/testdir/test_cindent.vim +++ b/src/nvim/testdir/test_cindent.vim @@ -18,25 +18,25 @@ endfunc func Test_cino_extern_c() " Test for cino-E - let without_ind = [ - \ '#ifdef __cplusplus', - \ 'extern "C" {', - \ '#endif', - \ 'int func_a(void);', - \ '#ifdef __cplusplus', - \ '}', - \ '#endif' - \ ] + let without_ind =<< trim [CODE] + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif + [CODE] - let with_ind = [ - \ '#ifdef __cplusplus', - \ 'extern "C" {', - \ '#endif', - \ "\tint func_a(void);", - \ '#ifdef __cplusplus', - \ '}', - \ '#endif' - \ ] + let with_ind =<< trim [CODE] + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif + [CODE] new setlocal cindent cinoptions=E0 call setline(1, without_ind) @@ -89,17 +89,42 @@ func Test_cindent_expr() return v:lnum == 1 ? shiftwidth() : 0 endfunc setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction() - call setline(1, ['var_a = something()', 'b = something()']) + let testinput =<< trim [CODE] + var_a = something() + b = something() + [CODE] + call setline(1, testinput) call cursor(1, 1) call feedkeys("^\<c-v>j$A;\<esc>", 'tnix') - call assert_equal([' var_a = something();', 'b = something();'], getline(1, '$')) + let expected =<< [CODE] + var_a = something(); +b = something(); +[CODE] + call assert_equal(expected, getline(1, '$')) %d - call setline(1, [' var_a = something()', ' b = something()']) + let testinput =<< [CODE] + var_a = something() + b = something() +[CODE] + call setline(1, testinput) call cursor(1, 1) call feedkeys("^\<c-v>j$A;\<esc>", 'tnix') - call assert_equal([' var_a = something();', ' b = something()'], getline(1, '$')) + let expected =<< [CODE] + var_a = something(); + b = something() +[CODE] + call assert_equal(expected, getline(1, '$')) bw! endfunc +" this was going beyond the end of the line. +func Test_cindent_case() + new + call setline(1, "case x: // x") + set cindent + norm! f:a: + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |