comparison src/testdir/test_packadd.vim @ 31798:5948cc887603 v9.0.1231

patch 9.0.1231: completion of :runtime does not handle {where} argument Commit: https://github.com/vim/vim/commit/3770f4c9cde7b5fcd10b6fa2e665cd0b69450fb2 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Jan 22 18:38:51 2023 +0000 patch 9.0.1231: completion of :runtime does not handle {where} argument Problem: Completion of :runtime does not handle {where} argument. Solution: Parse the {where} argument. (closes https://github.com/vim/vim/issues/11863)
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 Jan 2023 19:45:04 +0100
parents 457ea0570b6f
children c5ff7d053fa1
comparison
equal deleted inserted replaced
31797:dd6495176845 31798:5948cc887603
188 let optdir1 = &packpath . '/pack/mine/opt' 188 let optdir1 = &packpath . '/pack/mine/opt'
189 let optdir2 = &packpath . '/pack/candidate/opt' 189 let optdir2 = &packpath . '/pack/candidate/opt'
190 190
191 call mkdir(optdir1 . '/pluginA', 'p') 191 call mkdir(optdir1 . '/pluginA', 'p')
192 call mkdir(optdir1 . '/pluginC', 'p') 192 call mkdir(optdir1 . '/pluginC', 'p')
193 call writefile([], optdir1 . '/unrelated')
193 call mkdir(optdir2 . '/pluginB', 'p') 194 call mkdir(optdir2 . '/pluginB', 'p')
194 call mkdir(optdir2 . '/pluginC', 'p') 195 call mkdir(optdir2 . '/pluginC', 'p')
196 call writefile([], optdir2 . '/unrelated')
195 197
196 let li = [] 198 let li = []
197 call feedkeys(":packadd \<Tab>')\<C-B>call add(li, '\<CR>", 't') 199 call feedkeys(":packadd \<Tab>')\<C-B>call add(li, '\<CR>", 't')
198 call feedkeys(":packadd " . repeat("\<Tab>", 2) . "')\<C-B>call add(li, '\<CR>", 't') 200 call feedkeys(":packadd " . repeat("\<Tab>", 2) . "')\<C-B>call add(li, '\<CR>", 't')
199 call feedkeys(":packadd " . repeat("\<Tab>", 3) . "')\<C-B>call add(li, '\<CR>", 't') 201 call feedkeys(":packadd " . repeat("\<Tab>", 3) . "')\<C-B>call add(li, '\<CR>", 't')
365 let g:sequence = '' 367 let g:sequence = ''
366 runtime! ALL extra/bar.vim 368 runtime! ALL extra/bar.vim
367 call assert_equal('runstartopt', g:sequence) 369 call assert_equal('runstartopt', g:sequence)
368 endfunc 370 endfunc
369 371
372 func Test_runtime_completion()
373 let rundir = &packpath . '/runtime/Xextra'
374 let startdir = &packpath . '/pack/mine/start/foo/Xextra'
375 let optdir = &packpath . '/pack/mine/opt/bar/Xextra'
376 call mkdir(rundir . '/Xrunbaz', 'p')
377 call mkdir(startdir . '/Xstartbaz', 'p')
378 call mkdir(optdir . '/Xoptbaz', 'p')
379 call writefile([], rundir . '/../Xrunfoo.vim')
380 call writefile([], rundir . '/Xrunbar.vim')
381 call writefile([], rundir . '/Xunrelated')
382 call writefile([], rundir . '/../Xunrelated')
383 call writefile([], startdir . '/../Xstartfoo.vim')
384 call writefile([], startdir . '/Xstartbar.vim')
385 call writefile([], startdir . '/Xunrelated')
386 call writefile([], startdir . '/../Xunrelated')
387 call writefile([], optdir . '/../Xoptfoo.vim')
388 call writefile([], optdir . '/Xoptbar.vim')
389 call writefile([], optdir . '/Xunrelated')
390 call writefile([], optdir . '/../Xunrelated')
391 exe 'set rtp=' . &packpath . '/runtime'
392
393 func Check_runtime_completion(arg, arg1, res)
394 call feedkeys(':runtime ' .. a:arg .. "\<C-A>\<C-B>\"\<CR>", 'xt')
395 call assert_equal('"runtime ' .. a:arg1 .. join(a:res), @:)
396 call assert_equal(a:res, getcompletion(a:arg, 'runtime'))
397
398 call feedkeys(':runtime ' .. a:arg .. "X\<C-A>\<C-B>\"\<CR>", 'xt')
399 call assert_equal('"runtime ' .. a:arg1 .. join(a:res), @:)
400 call assert_equal(a:res, getcompletion(a:arg .. 'X', 'runtime'))
401 endfunc
402
403 call Check_runtime_completion('', '',
404 \ ['Xextra/', 'Xrunfoo.vim'])
405 call Check_runtime_completion('Xextra/', '',
406 \ ['Xextra/Xrunbar.vim', 'Xextra/Xrunbaz/'])
407
408 call Check_runtime_completion('START ', 'START ',
409 \ ['Xextra/', 'Xstartfoo.vim'])
410 call Check_runtime_completion('START Xextra/', 'START ',
411 \ ['Xextra/Xstartbar.vim', 'Xextra/Xstartbaz/'])
412
413 call Check_runtime_completion('OPT ', 'OPT ',
414 \ ['Xextra/', 'Xoptfoo.vim'])
415 call Check_runtime_completion('OPT Xextra/', 'OPT ',
416 \ ['Xextra/Xoptbar.vim', 'Xextra/Xoptbaz/'])
417
418 call Check_runtime_completion('PACK ', 'PACK ',
419 \ ['Xextra/', 'Xoptfoo.vim', 'Xstartfoo.vim'])
420 call Check_runtime_completion('PACK Xextra/', 'PACK ',
421 \ ['Xextra/Xoptbar.vim', 'Xextra/Xoptbaz/',
422 \ 'Xextra/Xstartbar.vim', 'Xextra/Xstartbaz/'])
423
424 call Check_runtime_completion('ALL ', 'ALL ',
425 \ ['Xextra/', 'Xoptfoo.vim', 'Xrunfoo.vim', 'Xstartfoo.vim'])
426 call Check_runtime_completion('ALL Xextra/', 'ALL ',
427 \ ['Xextra/Xoptbar.vim', 'Xextra/Xoptbaz/',
428 \ 'Xextra/Xrunbar.vim', 'Xextra/Xrunbaz/',
429 \ 'Xextra/Xstartbar.vim', 'Xextra/Xstartbaz/'])
430
431 delfunc Check_runtime_completion
432 endfunc
433
370 " vim: shiftwidth=2 sts=2 expandtab 434 " vim: shiftwidth=2 sts=2 expandtab