mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
tests: Modernize migrated argument_count test.
This commit is contained in:

committed by
Justin M. Keyes

parent
55806fbe39
commit
c2065a183f
@@ -1,8 +1,8 @@
|
|||||||
-- Tests for :[count]argument! and :[count]argdelete
|
-- Tests for :[count]argument! and :[count]argdelete
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')
|
local helpers = require('test.functional.helpers')
|
||||||
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
local clear, execute, eq, eval =
|
||||||
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
helpers.clear, helpers.execute, helpers.eq, helpers.eval
|
||||||
|
|
||||||
describe('argument_count', function()
|
describe('argument_count', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
@@ -10,6 +10,7 @@ describe('argument_count', function()
|
|||||||
it('is working', function()
|
it('is working', function()
|
||||||
execute('%argd')
|
execute('%argd')
|
||||||
execute('argadd a b c d')
|
execute('argadd a b c d')
|
||||||
|
eq({'a', 'b', 'c', 'd'}, eval('argv()'))
|
||||||
execute('set hidden')
|
execute('set hidden')
|
||||||
execute('let buffers = []')
|
execute('let buffers = []')
|
||||||
execute('augroup TEST')
|
execute('augroup TEST')
|
||||||
@@ -23,42 +24,24 @@ describe('argument_count', function()
|
|||||||
execute('augroup TEST')
|
execute('augroup TEST')
|
||||||
execute('au!')
|
execute('au!')
|
||||||
execute('augroup END')
|
execute('augroup END')
|
||||||
execute('let arglists = []')
|
eq({'d', 'c', 'b', 'a', 'c'}, eval('buffers'))
|
||||||
execute('.argd')
|
execute('.argd')
|
||||||
execute('call add(arglists, argv())')
|
eq({'a', 'b', 'd'}, eval('argv()'))
|
||||||
execute('-argd')
|
execute('-argd')
|
||||||
execute('call add(arglists, argv())')
|
eq({'a', 'd'}, eval('argv()'))
|
||||||
execute('$argd')
|
execute('$argd')
|
||||||
execute('call add(arglists, argv())')
|
eq({'a'}, eval('argv()'))
|
||||||
execute('1arga c')
|
execute('1arga c')
|
||||||
execute('1arga b')
|
execute('1arga b')
|
||||||
execute('$argu')
|
execute('$argu')
|
||||||
execute('$arga x')
|
execute('$arga x')
|
||||||
execute('call add(arglists, argv())')
|
eq({'a', 'b', 'c', 'x'}, eval('argv()'))
|
||||||
execute('0arga Y')
|
execute('0arga Y')
|
||||||
execute('call add(arglists, argv())')
|
eq({'Y', 'a', 'b', 'c', 'x'}, eval('argv()'))
|
||||||
execute('%argd')
|
execute('%argd')
|
||||||
execute('call add(arglists, argv())')
|
eq({}, eval('argv()'))
|
||||||
execute('arga a b c d e f')
|
execute('arga a b c d e f')
|
||||||
execute('2,$-argd')
|
execute('2,$-argd')
|
||||||
execute('call add(arglists, argv())')
|
eq({'a', 'f'}, eval('argv()'))
|
||||||
execute('call append(0, buffers)')
|
|
||||||
execute([[let lnr = line('$')]])
|
|
||||||
execute([[call append(lnr, map(copy(arglists), 'join(v:val, " ")'))]])
|
|
||||||
-- Assert buffer contents.
|
|
||||||
expect([=[
|
|
||||||
d
|
|
||||||
c
|
|
||||||
b
|
|
||||||
a
|
|
||||||
c
|
|
||||||
|
|
||||||
a b d
|
|
||||||
a d
|
|
||||||
a
|
|
||||||
a b c x
|
|
||||||
Y a b c x
|
|
||||||
|
|
||||||
a f]=])
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user