comparison src/testdir/test_indent.vim @ 19613:9c15be376631 v8.2.0363

patch 8.2.0363: some Normal mode commands not tested Commit: https://github.com/vim/vim/commit/f5f1e10d0d39890298cdf27f664d466c8872b87e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 8 05:13:15 2020 +0100 patch 8.2.0363: some Normal mode commands not tested Problem: Some Normal mode commands not tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5746)
author Bram Moolenaar <Bram@vim.org>
date Sun, 08 Mar 2020 05:15:04 +0100
parents 6d3c683466f4
children a659d390d3fd
comparison
equal deleted inserted replaced
19612:a70ee453358e 19613:9c15be376631
96 call assert_equal(" \t l", getline(2)) 96 call assert_equal(" \t l", getline(2))
97 set sw& ai& et& ci& 97 set sw& ai& et& ci&
98 close! 98 close!
99 endfunc 99 endfunc
100 100
101 " Test for changing multiple lines with lisp indent
102 func Test_lisp_indent_change_multiline()
103 new
104 setlocal lisp autoindent
105 call setline(1, ['(if a', ' (if b', ' (return 5)))'])
106 normal! jc2j(return 4))
107 call assert_equal(' (return 4))', getline(2))
108 close!
109 endfunc
110
111 func Test_lisp_indent()
112 new
113 setlocal lisp autoindent
114 call setline(1, ['(if a', ' ;; comment', ' \ abc', '', ' " str1\', ' " st\b', ' (return 5)'])
115 normal! jo;; comment
116 normal! jo\ abc
117 normal! jo;; ret
118 normal! jostr1"
119 normal! jostr2"
120 call assert_equal([' ;; comment', ' ;; comment', ' \ abc', ' \ abc', '', ' ;; ret', ' " str1\', ' str1"', ' " st\b', ' str2"'], getline(2, 11))
121 close!
122 endfunc
123
124 " Test for setting the 'indentexpr' from a modeline
125 func Test_modeline_indent_expr()
126 let modeline = &modeline
127 set modeline
128 func GetIndent()
129 return line('.') * 2
130 endfunc
131 call writefile(['# vim: indentexpr=GetIndent()'], 'Xfile.txt')
132 set modelineexpr
133 new Xfile.txt
134 call assert_equal('GetIndent()', &indentexpr)
135 exe "normal Oa\nb\n"
136 call assert_equal([' a', ' b'], getline(1, 2))
137 set modelineexpr&
138 delfunc GetIndent
139 let &modeline = modeline
140 close!
141 endfunc
142
101 " vim: shiftwidth=2 sts=2 expandtab 143 " vim: shiftwidth=2 sts=2 expandtab