comparison src/testdir/test_packadd.vim @ 31811:c5ff7d053fa1 v9.0.1238

patch 9.0.1238: :runtime completion can be further improved Commit: https://github.com/vim/vim/commit/5c8771bc5a2be123ab8e6325fa60ed524e8efb09 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Jan 24 12:34:03 2023 +0000 patch 9.0.1238: :runtime completion can be further improved Problem: :runtime completion can be further improved. Solution: Also complete the {where} argument values and adjust the completion for that. (closes #11874)
author Bram Moolenaar <Bram@vim.org>
date Tue, 24 Jan 2023 13:45:06 +0100
parents 5948cc887603
children aec031683d61
comparison
equal deleted inserted replaced
31810:8aec42ee247f 31811:c5ff7d053fa1
368 runtime! ALL extra/bar.vim 368 runtime! ALL extra/bar.vim
369 call assert_equal('runstartopt', g:sequence) 369 call assert_equal('runstartopt', g:sequence)
370 endfunc 370 endfunc
371 371
372 func Test_runtime_completion() 372 func Test_runtime_completion()
373 let rundir = &packpath . '/runtime/Xextra' 373 let rundir = &packpath . '/runtime/Aextra'
374 let startdir = &packpath . '/pack/mine/start/foo/Xextra' 374 let startdir = &packpath . '/pack/mine/start/foo/Aextra'
375 let optdir = &packpath . '/pack/mine/opt/bar/Xextra' 375 let optdir = &packpath . '/pack/mine/opt/bar/Aextra'
376 call mkdir(rundir . '/Xrunbaz', 'p') 376 call mkdir(rundir . '/Arunbaz', 'p')
377 call mkdir(startdir . '/Xstartbaz', 'p') 377 call mkdir(startdir . '/Astartbaz', 'p')
378 call mkdir(optdir . '/Xoptbaz', 'p') 378 call mkdir(optdir . '/Aoptbaz', 'p')
379 call writefile([], rundir . '/../Xrunfoo.vim') 379 call writefile([], rundir . '/../Arunfoo.vim')
380 call writefile([], rundir . '/Xrunbar.vim') 380 call writefile([], rundir . '/Arunbar.vim')
381 call writefile([], rundir . '/Xunrelated') 381 call writefile([], rundir . '/Aunrelated')
382 call writefile([], rundir . '/../Xunrelated') 382 call writefile([], rundir . '/../Aunrelated')
383 call writefile([], startdir . '/../Xstartfoo.vim') 383 call writefile([], startdir . '/../Astartfoo.vim')
384 call writefile([], startdir . '/Xstartbar.vim') 384 call writefile([], startdir . '/Astartbar.vim')
385 call writefile([], startdir . '/Xunrelated') 385 call writefile([], startdir . '/Aunrelated')
386 call writefile([], startdir . '/../Xunrelated') 386 call writefile([], startdir . '/../Aunrelated')
387 call writefile([], optdir . '/../Xoptfoo.vim') 387 call writefile([], optdir . '/../Aoptfoo.vim')
388 call writefile([], optdir . '/Xoptbar.vim') 388 call writefile([], optdir . '/Aoptbar.vim')
389 call writefile([], optdir . '/Xunrelated') 389 call writefile([], optdir . '/Aunrelated')
390 call writefile([], optdir . '/../Xunrelated') 390 call writefile([], optdir . '/../Aunrelated')
391 exe 'set rtp=' . &packpath . '/runtime' 391 exe 'set rtp=' . &packpath . '/runtime'
392 392
393 func Check_runtime_completion(arg, arg1, res) 393 func Check_runtime_completion(arg, arg1, res)
394 call feedkeys(':runtime ' .. a:arg .. "\<C-A>\<C-B>\"\<CR>", 'xt') 394 call feedkeys(':runtime ' .. a:arg .. "\<C-A>\<C-B>\"\<CR>", 'xt')
395 call assert_equal('"runtime ' .. a:arg1 .. join(a:res), @:) 395 call assert_equal('"runtime ' .. a:arg1 .. join(a:res), @:)
396 call assert_equal(a:res, getcompletion(a:arg, 'runtime')) 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 397 endfunc
402 398
403 call Check_runtime_completion('', '', 399 call Check_runtime_completion('', '',
404 \ ['Xextra/', 'Xrunfoo.vim']) 400 \ ['Aextra/', 'Arunfoo.vim', 'START', 'OPT', 'PACK', 'ALL'])
405 call Check_runtime_completion('Xextra/', '', 401 call Check_runtime_completion('S', '',
406 \ ['Xextra/Xrunbar.vim', 'Xextra/Xrunbaz/']) 402 \ ['START'])
403 call Check_runtime_completion('O', '',
404 \ ['OPT'])
405 call Check_runtime_completion('P', '',
406 \ ['PACK'])
407 call Check_runtime_completion('A', '',
408 \ ['Aextra/', 'Arunfoo.vim', 'ALL'])
409 call Check_runtime_completion('Aextra/', '',
410 \ ['Aextra/Arunbar.vim', 'Aextra/Arunbaz/'])
407 411
408 call Check_runtime_completion('START ', 'START ', 412 call Check_runtime_completion('START ', 'START ',
409 \ ['Xextra/', 'Xstartfoo.vim']) 413 \ ['Aextra/', 'Astartfoo.vim'])
410 call Check_runtime_completion('START Xextra/', 'START ', 414 call Check_runtime_completion('START A', 'START ',
411 \ ['Xextra/Xstartbar.vim', 'Xextra/Xstartbaz/']) 415 \ ['Aextra/', 'Astartfoo.vim'])
416 call Check_runtime_completion('START Aextra/', 'START ',
417 \ ['Aextra/Astartbar.vim', 'Aextra/Astartbaz/'])
412 418
413 call Check_runtime_completion('OPT ', 'OPT ', 419 call Check_runtime_completion('OPT ', 'OPT ',
414 \ ['Xextra/', 'Xoptfoo.vim']) 420 \ ['Aextra/', 'Aoptfoo.vim'])
415 call Check_runtime_completion('OPT Xextra/', 'OPT ', 421 call Check_runtime_completion('OPT A', 'OPT ',
416 \ ['Xextra/Xoptbar.vim', 'Xextra/Xoptbaz/']) 422 \ ['Aextra/', 'Aoptfoo.vim'])
423 call Check_runtime_completion('OPT Aextra/', 'OPT ',
424 \ ['Aextra/Aoptbar.vim', 'Aextra/Aoptbaz/'])
417 425
418 call Check_runtime_completion('PACK ', 'PACK ', 426 call Check_runtime_completion('PACK ', 'PACK ',
419 \ ['Xextra/', 'Xoptfoo.vim', 'Xstartfoo.vim']) 427 \ ['Aextra/', 'Aoptfoo.vim', 'Astartfoo.vim'])
420 call Check_runtime_completion('PACK Xextra/', 'PACK ', 428 call Check_runtime_completion('PACK A', 'PACK ',
421 \ ['Xextra/Xoptbar.vim', 'Xextra/Xoptbaz/', 429 \ ['Aextra/', 'Aoptfoo.vim', 'Astartfoo.vim'])
422 \ 'Xextra/Xstartbar.vim', 'Xextra/Xstartbaz/']) 430 call Check_runtime_completion('PACK Aextra/', 'PACK ',
431 \ ['Aextra/Aoptbar.vim', 'Aextra/Aoptbaz/',
432 \ 'Aextra/Astartbar.vim', 'Aextra/Astartbaz/'])
423 433
424 call Check_runtime_completion('ALL ', 'ALL ', 434 call Check_runtime_completion('ALL ', 'ALL ',
425 \ ['Xextra/', 'Xoptfoo.vim', 'Xrunfoo.vim', 'Xstartfoo.vim']) 435 \ ['Aextra/', 'Aoptfoo.vim', 'Arunfoo.vim', 'Astartfoo.vim'])
426 call Check_runtime_completion('ALL Xextra/', 'ALL ', 436 call Check_runtime_completion('ALL A', 'ALL ',
427 \ ['Xextra/Xoptbar.vim', 'Xextra/Xoptbaz/', 437 \ ['Aextra/', 'Aoptfoo.vim', 'Arunfoo.vim', 'Astartfoo.vim'])
428 \ 'Xextra/Xrunbar.vim', 'Xextra/Xrunbaz/', 438 call Check_runtime_completion('ALL Aextra/', 'ALL ',
429 \ 'Xextra/Xstartbar.vim', 'Xextra/Xstartbaz/']) 439 \ ['Aextra/Aoptbar.vim', 'Aextra/Aoptbaz/',
440 \ 'Aextra/Arunbar.vim', 'Aextra/Arunbaz/',
441 \ 'Aextra/Astartbar.vim', 'Aextra/Astartbaz/'])
430 442
431 delfunc Check_runtime_completion 443 delfunc Check_runtime_completion
432 endfunc 444 endfunc
433 445
434 " vim: shiftwidth=2 sts=2 expandtab 446 " vim: shiftwidth=2 sts=2 expandtab