Merge #2820 'tests: migrate legacy test argument_count.'.

This commit is contained in:
Justin M. Keyes 2015-06-16 01:36:17 -04:00
commit 8fa77bbfaf
4 changed files with 47 additions and 60 deletions

View File

@ -27,7 +27,6 @@ SCRIPTS := test_eval.out \
test86.out test87.out test88.out \
test_listlbr.out \
test_breakindent.out \
test_argument_count.out \
test_close_count.out \
test_command_count.out \

View File

@ -1,46 +0,0 @@
Tests for :[count]argument! and :[count]argdelete vim: set ft=vim :
STARTTEST
:%argd
:argadd a b c d
:set hidden
:let buffers = []
:augroup TEST
:au BufEnter * call add(buffers, expand('%:t'))
:augroup END
:$argu
:$-argu
:-argu
:1argu
:+2argu
:augroup TEST
:au!
:augroup END
:let arglists = []
:.argd
:call add(arglists, argv())
:-argd
:call add(arglists, argv())
:$argd
:call add(arglists, argv())
:1arga c
:1arga b
:$argu
:$arga x
:call add(arglists, argv())
:0arga Y
:call add(arglists, argv())
:%argd
:call add(arglists, argv())
:arga a b c d e f
:2,$-argd
:call add(arglists, argv())
:e! test.out
:call append(0, buffers)
:let lnr = line('$')
:call append(lnr, map(copy(arglists), 'join(v:val, " ")'))
:w
:qa!
ENDTEST

View File

@ -1,13 +0,0 @@
d
c
b
a
c
a b d
a d
a
a b c x
Y a b c x
a f

View File

@ -0,0 +1,47 @@
-- Tests for :[count]argument! and :[count]argdelete
local helpers = require('test.functional.helpers')
local clear, execute, eq, eval =
helpers.clear, helpers.execute, helpers.eq, helpers.eval
describe('argument_count', function()
setup(clear)
it('is working', function()
execute('%argd')
execute('argadd a b c d')
eq({'a', 'b', 'c', 'd'}, eval('argv()'))
execute('set hidden')
execute('let buffers = []')
execute('augroup TEST')
execute([[au BufEnter * call add(buffers, expand('%:t'))]])
execute('augroup END')
execute('$argu')
execute('$-argu')
execute('-argu')
execute('1argu')
execute('+2argu')
execute('augroup TEST')
execute('au!')
execute('augroup END')
eq({'d', 'c', 'b', 'a', 'c'}, eval('buffers'))
execute('.argd')
eq({'a', 'b', 'd'}, eval('argv()'))
execute('-argd')
eq({'a', 'd'}, eval('argv()'))
execute('$argd')
eq({'a'}, eval('argv()'))
execute('1arga c')
execute('1arga b')
execute('$argu')
execute('$arga x')
eq({'a', 'b', 'c', 'x'}, eval('argv()'))
execute('0arga Y')
eq({'Y', 'a', 'b', 'c', 'x'}, eval('argv()'))
execute('%argd')
eq({}, eval('argv()'))
execute('arga a b c d e f')
execute('2,$-argd')
eq({'a', 'f'}, eval('argv()'))
end)
end)