Mercurial > vim
comparison src/testdir/test_history.vim @ 19570:43c04edcafec v8.2.0342
patch 8.2.0342: some code in ex_getln.c not covered by tests
Commit: https://github.com/vim/vim/commit/0546d7df13b041833121b2d56036e1c62ea3b0c1
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 1 16:53:09 2020 +0100
patch 8.2.0342: some code in ex_getln.c not covered by tests
Problem: Some code in ex_getln.c not covered by tests.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5717)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Mar 2020 17:00:06 +0100 |
parents | bab20768e1fd |
children | 848dc460adf0 |
comparison
equal
deleted
inserted
replaced
19569:be76a82ee030 | 19570:43c04edcafec |
---|---|
112 call assert_equal('a', getline('.')) | 112 call assert_equal('a', getline('.')) |
113 call assert_equal('a', @/) | 113 call assert_equal('a', @/) |
114 bwipe! | 114 bwipe! |
115 endfunc | 115 endfunc |
116 | 116 |
117 " Test for :history command option completion | |
117 function Test_history_completion() | 118 function Test_history_completion() |
118 call feedkeys(":history \<C-A>\<C-B>\"\<CR>", 'tx') | 119 call feedkeys(":history \<C-A>\<C-B>\"\<CR>", 'tx') |
119 call assert_equal('"history / : = > ? @ all cmd debug expr input search', @:) | 120 call assert_equal('"history / : = > ? @ all cmd debug expr input search', @:) |
120 endfunc | 121 endfunc |
121 | 122 |
122 " Test for increasing the 'history' option value | 123 " Test for increasing the 'history' option value |
123 func Test_history_size() | 124 func Test_history_size() |
124 let save_histsz = &history | 125 let save_histsz = &history |
126 set history=10 | |
127 call histadd(':', 'ls') | |
125 call histdel(':') | 128 call histdel(':') |
126 set history=10 | |
127 for i in range(1, 5) | 129 for i in range(1, 5) |
128 call histadd(':', 'cmd' .. i) | 130 call histadd(':', 'cmd' .. i) |
129 endfor | 131 endfor |
130 call assert_equal(5, histnr(':')) | 132 call assert_equal(5, histnr(':')) |
131 call assert_equal('cmd5', histget(':', -1)) | 133 call assert_equal('cmd5', histget(':', -1)) |
171 let @/ = '' | 173 let @/ = '' |
172 call feedkeys("/\<Up>\<F2>\<Up>\<F2>\<Down>\<Down>\<F2>\<Esc>", 'xt') | 174 call feedkeys("/\<Up>\<F2>\<Up>\<F2>\<Down>\<Down>\<F2>\<Esc>", 'xt') |
173 call assert_equal(['pat2', 'pat1', ''], g:pat) | 175 call assert_equal(['pat2', 'pat1', ''], g:pat) |
174 cunmap <F2> | 176 cunmap <F2> |
175 delfunc SavePat | 177 delfunc SavePat |
178 | |
179 " Recall patterns with 'history' set to 0 | |
180 set history=0 | |
181 let @/ = 'abc' | |
182 let cmd = 'call feedkeys("/\<Up>\<Down>\<S-Up>\<S-Down>\<CR>", "xt")' | |
183 call assert_fails(cmd, 'E486:') | |
184 set history& | |
176 endfunc | 185 endfunc |
177 | 186 |
178 " Test for making sure the key value is not stored in history | 187 " Test for making sure the key value is not stored in history |
179 func Test_history_crypt_key() | 188 func Test_history_crypt_key() |
180 CheckFeature cryptv | 189 CheckFeature cryptv |