annotate src/testdir/test_smartindent.vim @ 17437:5f71f12bdb8c

Added tag v8.1.1716 for changeset e1b5c15f5fee70aaa68aa8286030cf713a403aee
author Bram Moolenaar <Bram@vim.org>
date Fri, 19 Jul 2019 23:30:05 +0200
parents 63b02fcf1361
children 6d3c683466f4
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.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
4 func Test_nosmartindent()
10145
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",
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
7 \ " test text",
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
8 \ "test text",
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
9 \ " test text"])
10145
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
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
15 endfunc
11943
268b1036cd17 patch 8.0.0851: 'smartindent' is used even when 'indentexpr' is set
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
16
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
17 func MyIndent()
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
18 endfunc
11943
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.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
21 func Test_smartindent_has_no_effect()
11943
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!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11943
diff changeset
39 endfunc
11943
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