Skip to content

Commit

Permalink
patch 8.0.0473: no test covering arg_all()
Browse files Browse the repository at this point in the history
Problem:    No test covering arg_all().
Solution:   Add a test expanding ##.
  • Loading branch information
brammool committed Mar 16, 2017
1 parent c537947 commit 8c34aa0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
47 changes: 27 additions & 20 deletions src/testdir/test_arglist.vim
Expand Up @@ -90,7 +90,7 @@ endfunc

" Test for [count]argument and [count]argdelete commands
" Ported from the test_argument_count.in test script
function Test_argument()
func Test_argument()
" Clean the argument list
arga a | %argd

Expand Down Expand Up @@ -162,11 +162,11 @@ function Test_argument()

%argdelete
call assert_fails('argument', 'E163:')
endfunction
endfunc

" Test for 0argadd and 0argedit
" Ported from the test_argument_0count.in test script
function Test_zero_argadd()
func Test_zero_argadd()
" Clean the argument list
arga a | %argd

Expand All @@ -188,22 +188,22 @@ function Test_zero_argadd()
2argu
arga third
call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv())
endfunction
endfunc

function Reset_arglist()
func Reset_arglist()
args a | %argd
endfunction
endfunc

" Test for argc()
function Test_argc()
func Test_argc()
call Reset_arglist()
call assert_equal(0, argc())
argadd a b
call assert_equal(2, argc())
endfunction
endfunc

" Test for arglistid()
function Test_arglistid()
func Test_arglistid()
call Reset_arglist()
arga a b
call assert_equal(0, arglistid())
Expand All @@ -218,19 +218,19 @@ function Test_arglistid()
tabonly | only | enew!
argglobal
call assert_equal(0, arglistid())
endfunction
endfunc

" Test for argv()
function Test_argv()
func Test_argv()
call Reset_arglist()
call assert_equal([], argv())
call assert_equal("", argv(2))
argadd a b c d
call assert_equal('c', argv(2))
endfunction
endfunc

" Test for the :argedit command
function Test_argedit()
func Test_argedit()
call Reset_arglist()
argedit a
call assert_equal(['a'], argv())
Expand All @@ -254,10 +254,10 @@ function Test_argedit()
argedit! y
call assert_equal(['x', 'y', 'a', 'c', 'b'], argv())
%argd
endfunction
endfunc

" Test for the :argdelete command
function Test_argdelete()
func Test_argdelete()
call Reset_arglist()
args aa a aaa b bb
argdelete a*
Expand All @@ -269,10 +269,10 @@ function Test_argdelete()
call assert_fails('argdelete', 'E471:')
call assert_fails('1,100argdelete', 'E16:')
%argd
endfunction
endfunc

" Tests for the :next, :prev, :first, :last, :rewind commands
function Test_argpos()
func Test_argpos()
call Reset_arglist()
args a b c d
last
Expand All @@ -290,10 +290,10 @@ function Test_argpos()
rewind
call assert_equal(0, argidx())
%argd
endfunction
endfunc

" 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
call writefile(['test file Xxx1'], 'Xxx1')
call writefile(['test file Xxx2'], 'Xxx2')
Expand All @@ -319,4 +319,11 @@ function Test_arglist_autocmd()
call delete('Xxx3')
argdelete Xxx*
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
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -764,6 +764,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
473,
/**/
472,
/**/
Expand Down

0 comments on commit 8c34aa0

Please sign in to comment.