annotate src/testdir/test_smartindent.vim @ 15290:424f2596f582 v8.1.0653

patch 8.1.0653: arglist test fails on MS-windows commit https://github.com/vim/vim/commit/3de8c2d1f027410db6a06f0fcd3355d96c8b8596 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 28 19:29:35 2018 +0100 patch 8.1.0653: arglist test fails on MS-windows Problem: Arglist test fails on MS-windows. Solution: Only use a file name with a double quote on Unix.
author Bram Moolenaar <Bram@vim.org>
date Fri, 28 Dec 2018 19:30:06 +0100
parents 268b1036cd17
children 63b02fcf1361
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11943
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
1 " Tests for smartindent
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Tests for not doing smart indenting when it isn't set.
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 function! Test_nosmartindent()
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 new
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call append(0, [" some test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 \ "test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 \ " test text"])
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 set nocindent nosmartindent autoindent
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 exe "normal! gg/some\<CR>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 exe "normal! 2cc#test\<Esc>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal(" #test", getline(1))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 enew! | close
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfunction
11943
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
16
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
17 function MyIndent()
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
18 endfunction
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
19
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
20 " When 'indentexpr' is set, setting 'si' has no effect.
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
21 function Test_smartindent_has_no_effect()
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
22 new
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
23 exe "normal! i\<Tab>one\<Esc>"
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
24 set noautoindent
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
25 set smartindent
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
26 set indentexpr=
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
27 exe "normal! Gotwo\<Esc>"
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
28 call assert_equal("\ttwo", getline("$"))
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
29
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
30 set indentexpr=MyIndent
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
31 exe "normal! Gothree\<Esc>"
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
32 call assert_equal("three", getline("$"))
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
33
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
34 delfunction! MyIndent
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
35 set autoindent&
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
36 set smartindent&
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
37 set indentexpr&
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
38 bwipe!
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
39 endfunction
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
40
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
41 " vim: shiftwidth=2 sts=2 expandtab