0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.0473: no test covering arg_all()

Problem:    No test covering arg_all().
Solution:   Add a test expanding ##.
This commit is contained in:
Bram Moolenaar
2017-03-16 22:52:32 +01:00
parent c537947100
commit 8c34aa09a4
2 changed files with 29 additions and 20 deletions

View File

@@ -90,7 +90,7 @@ endfunc
" Test for [count]argument and [count]argdelete commands " Test for [count]argument and [count]argdelete commands
" Ported from the test_argument_count.in test script " Ported from the test_argument_count.in test script
function Test_argument() func Test_argument()
" Clean the argument list " Clean the argument list
arga a | %argd arga a | %argd
@@ -162,11 +162,11 @@ function Test_argument()
%argdelete %argdelete
call assert_fails('argument', 'E163:') call assert_fails('argument', 'E163:')
endfunction endfunc
" Test for 0argadd and 0argedit " Test for 0argadd and 0argedit
" Ported from the test_argument_0count.in test script " Ported from the test_argument_0count.in test script
function Test_zero_argadd() func Test_zero_argadd()
" Clean the argument list " Clean the argument list
arga a | %argd arga a | %argd
@@ -188,22 +188,22 @@ function Test_zero_argadd()
2argu 2argu
arga third arga third
call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv()) call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv())
endfunction endfunc
function Reset_arglist() func Reset_arglist()
args a | %argd args a | %argd
endfunction endfunc
" Test for argc() " Test for argc()
function Test_argc() func Test_argc()
call Reset_arglist() call Reset_arglist()
call assert_equal(0, argc()) call assert_equal(0, argc())
argadd a b argadd a b
call assert_equal(2, argc()) call assert_equal(2, argc())
endfunction endfunc
" Test for arglistid() " Test for arglistid()
function Test_arglistid() func Test_arglistid()
call Reset_arglist() call Reset_arglist()
arga a b arga a b
call assert_equal(0, arglistid()) call assert_equal(0, arglistid())
@@ -218,19 +218,19 @@ function Test_arglistid()
tabonly | only | enew! tabonly | only | enew!
argglobal argglobal
call assert_equal(0, arglistid()) call assert_equal(0, arglistid())
endfunction endfunc
" Test for argv() " Test for argv()
function Test_argv() func Test_argv()
call Reset_arglist() call Reset_arglist()
call assert_equal([], argv()) call assert_equal([], argv())
call assert_equal("", argv(2)) call assert_equal("", argv(2))
argadd a b c d argadd a b c d
call assert_equal('c', argv(2)) call assert_equal('c', argv(2))
endfunction endfunc
" Test for the :argedit command " Test for the :argedit command
function Test_argedit() func Test_argedit()
call Reset_arglist() call Reset_arglist()
argedit a argedit a
call assert_equal(['a'], argv()) call assert_equal(['a'], argv())
@@ -254,10 +254,10 @@ function Test_argedit()
argedit! y argedit! y
call assert_equal(['x', 'y', 'a', 'c', 'b'], argv()) call assert_equal(['x', 'y', 'a', 'c', 'b'], argv())
%argd %argd
endfunction endfunc
" Test for the :argdelete command " Test for the :argdelete command
function Test_argdelete() func Test_argdelete()
call Reset_arglist() call Reset_arglist()
args aa a aaa b bb args aa a aaa b bb
argdelete a* argdelete a*
@@ -269,10 +269,10 @@ function Test_argdelete()
call assert_fails('argdelete', 'E471:') call assert_fails('argdelete', 'E471:')
call assert_fails('1,100argdelete', 'E16:') call assert_fails('1,100argdelete', 'E16:')
%argd %argd
endfunction endfunc
" Tests for the :next, :prev, :first, :last, :rewind commands " Tests for the :next, :prev, :first, :last, :rewind commands
function Test_argpos() func Test_argpos()
call Reset_arglist() call Reset_arglist()
args a b c d args a b c d
last last
@@ -290,10 +290,10 @@ function Test_argpos()
rewind rewind
call assert_equal(0, argidx()) call assert_equal(0, argidx())
%argd %argd
endfunction endfunc
" Test for autocommand that redefines the argument list, when doing ":all". " Test for autocommand that redefines the argument list, when doing ":all".
function Test_arglist_autocmd() func Test_arglist_autocmd()
autocmd BufReadPost Xxx2 next Xxx2 Xxx1 autocmd BufReadPost Xxx2 next Xxx2 Xxx1
call writefile(['test file Xxx1'], 'Xxx1') call writefile(['test file Xxx1'], 'Xxx1')
call writefile(['test file Xxx2'], 'Xxx2') call writefile(['test file Xxx2'], 'Xxx2')
@@ -319,4 +319,11 @@ function Test_arglist_autocmd()
call delete('Xxx3') call delete('Xxx3')
argdelete Xxx* argdelete Xxx*
bwipe! Xxx1 Xxx2 Xxx3 bwipe! Xxx1 Xxx2 Xxx3
endfunction endfunc
func Test_arg_all_expand()
call writefile(['test file Xxx1'], 'Xx x')
next notexist Xx\ x runtest.vim
call assert_equal('notexist Xx\ x runtest.vim', expand('##'))
call delete('Xx x')
endfunc

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
473,
/**/ /**/
472, 472,
/**/ /**/