Mercurial > vim
comparison src/testdir/test_arglist.vim @ 26169:0efbf4fe6cae v8.2.3616
patch 8.2.3616: arglist test does not clear the argument list consistently
Commit: https://github.com/vim/vim/commit/3cad47038547e694cfa26ba39c399f610d2054bd
Author: Shougo Matsushita <Shougo.Matsu@gmail.com>
Date: Thu Nov 18 15:37:29 2021 +0000
patch 8.2.3616: arglist test does not clear the argument list consistently
Problem: Arglist test does not clear the argument list consistently.
Solution: Call Reset_arglist(). (Shougo Matsushita, closes https://github.com/vim/vim/issues/9154)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 18 Nov 2021 16:45:04 +0100 |
parents | 28f1b7c38ba1 |
children | 5860bd619d30 |
comparison
equal
deleted
inserted
replaced
26168:105ab8907ae2 | 26169:0efbf4fe6cae |
---|---|
1 " Test argument list commands | 1 " Test argument list commands |
2 | 2 |
3 source check.vim | 3 source check.vim |
4 source shared.vim | 4 source shared.vim |
5 source term_util.vim | 5 source term_util.vim |
6 | |
7 func Reset_arglist() | |
8 args a | %argd | |
9 endfunc | |
6 | 10 |
7 func Test_argidx() | 11 func Test_argidx() |
8 args a b c | 12 args a b c |
9 last | 13 last |
10 call assert_equal(2, argidx()) | 14 call assert_equal(2, argidx()) |
28 1argdelete | 32 1argdelete |
29 call assert_equal(0, argidx()) | 33 call assert_equal(0, argidx()) |
30 endfunc | 34 endfunc |
31 | 35 |
32 func Test_argadd() | 36 func Test_argadd() |
37 call Reset_arglist() | |
38 | |
33 %argdelete | 39 %argdelete |
34 argadd a b c | 40 argadd a b c |
35 call assert_equal(0, argidx()) | 41 call assert_equal(0, argidx()) |
36 | 42 |
37 %argdelete | 43 %argdelete |
122 endfunc | 128 endfunc |
123 | 129 |
124 " Test for [count]argument and [count]argdelete commands | 130 " Test for [count]argument and [count]argdelete commands |
125 " Ported from the test_argument_count.in test script | 131 " Ported from the test_argument_count.in test script |
126 func Test_argument() | 132 func Test_argument() |
127 " Clean the argument list | 133 call Reset_arglist() |
128 arga a | %argd | |
129 | 134 |
130 let save_hidden = &hidden | 135 let save_hidden = &hidden |
131 set hidden | 136 set hidden |
132 | 137 |
133 let g:buffers = [] | 138 let g:buffers = [] |
215 %argdelete | 220 %argdelete |
216 call assert_fails('argument', 'E163:') | 221 call assert_fails('argument', 'E163:') |
217 endfunc | 222 endfunc |
218 | 223 |
219 func Test_list_arguments() | 224 func Test_list_arguments() |
220 " Clean the argument list | 225 call Reset_arglist() |
221 arga a | %argd | |
222 | 226 |
223 " four args half the screen width makes two lines with two columns | 227 " four args half the screen width makes two lines with two columns |
224 let aarg = repeat('a', &columns / 2 - 4) | 228 let aarg = repeat('a', &columns / 2 - 4) |
225 let barg = repeat('b', &columns / 2 - 4) | 229 let barg = repeat('b', &columns / 2 - 4) |
226 let carg = repeat('c', &columns / 2 - 4) | 230 let carg = repeat('c', &columns / 2 - 4) |
254 endfunc | 258 endfunc |
255 | 259 |
256 " Test for 0argadd and 0argedit | 260 " Test for 0argadd and 0argedit |
257 " Ported from the test_argument_0count.in test script | 261 " Ported from the test_argument_0count.in test script |
258 func Test_zero_argadd() | 262 func Test_zero_argadd() |
259 " Clean the argument list | 263 call Reset_arglist() |
260 arga a | %argd | |
261 | 264 |
262 arga a b c d | 265 arga a b c d |
263 2argu | 266 2argu |
264 0arga added | 267 0arga added |
265 call assert_equal(['added', 'a', 'b', 'c', 'd'], argv()) | 268 call assert_equal(['added', 'a', 'b', 'c', 'd'], argv()) |
280 | 283 |
281 2argu | 284 2argu |
282 argedit file\ with\ spaces another file | 285 argedit file\ with\ spaces another file |
283 call assert_equal(['edited', 'a', 'file with spaces', 'another', 'file', 'third', 'b', 'c', 'd'], argv()) | 286 call assert_equal(['edited', 'a', 'file with spaces', 'another', 'file', 'third', 'b', 'c', 'd'], argv()) |
284 call assert_equal('file with spaces', expand('%')) | 287 call assert_equal('file with spaces', expand('%')) |
285 endfunc | |
286 | |
287 func Reset_arglist() | |
288 args a | %argd | |
289 endfunc | 288 endfunc |
290 | 289 |
291 " Test for argc() | 290 " Test for argc() |
292 func Test_argc() | 291 func Test_argc() |
293 call Reset_arglist() | 292 call Reset_arglist() |