aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorJurica Bradaric <jbradaric@gmail.com>2016-05-14 12:40:05 +0200
committerJurica Bradaric <jbradaric@gmail.com>2016-05-14 15:51:30 +0200
commitdfdf7c02be1758f4adfe487a36f372f514dda39a (patch)
treeb71d36e03a29d435be63bc29a852937828f86299 /test/functional/legacy
parent1573aa0b0a0a17da93e4fb2220fd5d6ecbd6d267 (diff)
downloadrneovim-dfdf7c02be1758f4adfe487a36f372f514dda39a.tar.gz
rneovim-dfdf7c02be1758f4adfe487a36f372f514dda39a.tar.bz2
rneovim-dfdf7c02be1758f4adfe487a36f372f514dda39a.zip
vim-patch:7.4.1123
Problem: Using ":argadd" when there are no arguments results in the second argument to be the current one. (Yegappan Lakshmanan) Solution: Correct the w_arg_idx value. https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/arglist_spec.lua52
1 files changed, 51 insertions, 1 deletions
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index a569479b62..e85d8a7aca 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -8,7 +8,19 @@ local eq, eval = helpers.eq, helpers.eval
describe('argument list commands', function()
before_each(clear)
- it('is working', function()
+ function assert_argc(l)
+ eq(#l, eval('argc()'))
+ for i = 1, #l do
+ eq(l[i], eval('argv(' .. (i - 1) .. ')'))
+ end
+ end
+
+ function init_abc()
+ execute('args a b c')
+ execute('next')
+ end
+
+ it('test that argidx() works', function()
execute('args a b c')
execute('last')
eq(2, eval('argidx()'))
@@ -28,4 +40,42 @@ describe('argument list commands', function()
execute('1argdelete')
eq(0, eval('argidx()'))
end)
+
+ it('test that argadd() works', function()
+ execute('%argdelete')
+ execute('argadd a b c')
+ eq(0, eval('argidx()'))
+
+ execute('%argdelete')
+ execute('argadd a')
+ eq(0, eval('argidx()'))
+ execute('argadd b c d')
+ eq(0, eval('argidx()'))
+
+ init_abc()
+ execute('argadd x')
+ assert_argc({'a', 'b', 'x', 'c'})
+ eq(1, eval('argidx()'))
+
+ init_abc()
+ execute('0argadd x')
+ assert_argc({'x', 'a', 'b', 'c'})
+ eq(2, eval('argidx()'))
+
+ init_abc()
+ execute('1argadd x')
+ assert_argc({'a', 'x', 'b', 'c'})
+ eq(2, eval('argidx()'))
+
+ init_abc()
+ execute('$argadd x')
+ assert_argc({'a', 'b', 'c', 'x'})
+ eq(1, eval('argidx()'))
+
+ init_abc()
+ execute('$argadd x')
+ execute('+2argadd y')
+ assert_argc({'a', 'b', 'c', 'x', 'y'})
+ eq(1, eval('argidx()'))
+ end)
end)