summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_cindent.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-20 22:12:34 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-20 22:12:34 +0200
commitc79745a82faeb5a6058e915ca49a4c69fa60ea01 (patch)
treebe7dc4ecffe429763159bfef2f95c06ea7fb8b67 /src/testdir/test_cindent.vim
parent0b0ad35c339b8ad156df493bebeb77e02b32b120 (diff)
patch 8.1.1362: code and data in tests can be hard to readv8.1.1362
Problem: Code and data in tests can be hard to read. Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes #4400)
Diffstat (limited to 'src/testdir/test_cindent.vim')
-rw-r--r--src/testdir/test_cindent.vim60
1 files changed, 38 insertions, 22 deletions
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index 3b57360ace..4b1198a206 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/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,16 +89,32 @@ 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 =<< trim [CODE]
+ var_a = something();
+ b = something();
+ [CODE]
+ call assert_equal(expected, getline(1, '$'))
%d
- 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 =<< trim [CODE]
+ var_a = something();
+ b = something()
+ [CODE]
+ call assert_equal(expected, getline(1, '$'))
bw!
endfunc