annotate src/testdir/test_cindent.vim @ 16720:9c90cf08cfa8 v8.1.1362

patch 8.1.1362: code and data in tests can be hard to read commit https://github.com/vim/vim/commit/c79745a82faeb5a6058e915ca49a4c69fa60ea01 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 20 22:12:34 2019 +0200 patch 8.1.1362: code and data in tests can be hard to read Problem: Code and data in tests can be hard to read. Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4400)
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 May 2019 22:15:06 +0200
parents 81be817c9d9a
children d615cc95089c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11069
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for cinoptions and cindent
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 "
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " TODO: rewrite test3.in into this new style test
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_cino_hash()
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Test that curbuf->b_ind_hash_comment is correctly reset
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 new
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 setlocal cindent cinoptions=#1
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 setlocal cinoptions=
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call setline(1, ["#include <iostream>"])
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call cursor(1, 1)
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 norm! o#include
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 "call feedkeys("o#include\<esc>", 't')
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(["#include <iostream>", "#include"], getline(1,2))
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 bwipe!
814126a34c9d patch 8.0.0423: changing 'cinoptions' does not always work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
11087
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
17
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
18 func Test_cino_extern_c()
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
19 " Test for cino-E
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
20
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
21 let without_ind =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
22 #ifdef __cplusplus
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
23 extern "C" {
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
24 #endif
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
25 int func_a(void);
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
26 #ifdef __cplusplus
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
27 }
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
28 #endif
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
29 [CODE]
11087
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
30
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
31 let with_ind =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
32 #ifdef __cplusplus
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
33 extern "C" {
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
34 #endif
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
35 int func_a(void);
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
36 #ifdef __cplusplus
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
37 }
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
38 #endif
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
39 [CODE]
11087
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
40 new
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
41 setlocal cindent cinoptions=E0
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
42 call setline(1, without_ind)
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
43 call feedkeys("gg=G", 'tx')
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
44 call assert_equal(with_ind, getline(1, '$'))
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
45
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
46 setlocal cinoptions=E-s
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
47 call setline(1, with_ind)
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
48 call feedkeys("gg=G", 'tx')
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
49 call assert_equal(without_ind, getline(1, '$'))
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
50
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
51 setlocal cinoptions=Es
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
52 let tests = [
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
53 \ ['recognized', ['extern "C" {'], "\t\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
54 \ ['recognized', ['extern "C++" {'], "\t\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
55 \ ['recognized', ['extern /* com */ "C"{'], "\t\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
56 \ ['recognized', ['extern"C"{'], "\t\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
57 \ ['recognized', ['extern "C"', '{'], "\t\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
58 \ ['not recognized', ['extern {'], "\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
59 \ ['not recognized', ['extern /*"C"*/{'], "\t;"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
60 \ ['not recognized', ['extern "C" //{'], ";"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
61 \ ['not recognized', ['extern "C" /*{*/'], ";"],
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
62 \ ]
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
63
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
64 for pair in tests
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
65 let lines = pair[1]
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
66 call setline(1, lines)
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
67 call feedkeys(len(lines) . "Go;", 'tx')
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
68 call assert_equal(pair[2], getline(len(lines) + 1), 'Failed for "' . string(lines) . '"')
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
69 endfor
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
70
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
71 bwipe!
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
72 endfunc
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
73
12323
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
74 func Test_cindent_rawstring()
12238
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
75 new
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
76 setl cindent
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
77 call feedkeys("i" .
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
78 \ "int main() {\<CR>" .
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
79 \ "R\"(\<CR>" .
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
80 \ ")\";\<CR>" .
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
81 \ "statement;\<Esc>", "x")
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
82 call assert_equal("\tstatement;", getline(line('.')))
0066a7e178bc patch 8.0.0999: indenting raw C++ strings is wrong
Christian Brabandt <cb@256bit.org>
parents: 11087
diff changeset
83 bw!
12323
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
84 endfunc
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
85
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
86 func Test_cindent_expr()
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
87 new
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
88 func! MyIndentFunction()
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
89 return v:lnum == 1 ? shiftwidth() : 0
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
90 endfunc
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
91 setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction()
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
92 let testinput =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
93 var_a = something()
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
94 b = something()
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
95 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
96 call setline(1, testinput)
12323
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
97 call cursor(1, 1)
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
98 call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
99 let expected =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
100 var_a = something();
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
101 b = something();
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
102 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
103 call assert_equal(expected, getline(1, '$'))
12323
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
104
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
105 %d
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
106 let testinput =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
107 var_a = something()
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
108 b = something()
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
109 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
110 call setline(1, testinput)
12323
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
111 call cursor(1, 1)
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
112 call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
113 let expected =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
114 var_a = something();
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
115 b = something()
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
116 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16668
diff changeset
117 call assert_equal(expected, getline(1, '$'))
12323
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
118 bw!
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
119 endfunc
4dba3e4f3b01 patch 8.0.1041: bogus characters when indenting during visual-block append
Christian Brabandt <cb@256bit.org>
parents: 12238
diff changeset
120
16668
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
121 func Test_cindent_func()
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
122 new
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
123 setlocal cindent
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
124 call setline(1, ['int main(void)', '{', 'return 0;', '}'])
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
125 call assert_equal(cindent(0), -1)
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
126 call assert_equal(cindent(3), &sw)
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
127 call assert_equal(cindent(line('$')+1), -1)
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
128 bwipe!
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
129 endfunc
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12323
diff changeset
130
11087
242e0617aa51 patch 8.0.0431: 'cinoptions' cannot set indent for extern block
Christian Brabandt <cb@256bit.org>
parents: 11069
diff changeset
131 " vim: shiftwidth=2 sts=2 expandtab