diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-01-17 19:39:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-01-17 19:39:00 +0100 |
commit | a24f0a550fed3d9773800cf6be4efd072fff20ec (patch) | |
tree | ac78f6a57af6cbd09d96a2b2f1c2e6b81ac2125f /src/testdir/test_arglist.vim | |
parent | 42c9cfa7f4d2f176234e385573ff2fb1f61915e5 (diff) | |
download | vim-git-a24f0a550fed3d9773800cf6be4efd072fff20ec.tar.gz |
patch 7.4.1123v7.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.
Diffstat (limited to 'src/testdir/test_arglist.vim')
-rw-r--r-- | src/testdir/test_arglist.vim | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim index 3f72f0ff9..522631741 100644 --- a/src/testdir/test_arglist.vim +++ b/src/testdir/test_arglist.vim @@ -20,3 +20,55 @@ func Test_argidx() 1argdelete call assert_equal(0, argidx()) endfunc + +func Test_argadd() + %argdelete + argadd a b c + call assert_equal(0, argidx()) + + %argdelete + argadd a + call assert_equal(0, argidx()) + argadd b c d + call assert_equal(0, argidx()) + + call Init_abc() + argadd x + call Assert_argc(['a', 'b', 'x', 'c']) + call assert_equal(1, argidx()) + + call Init_abc() + 0argadd x + call Assert_argc(['x', 'a', 'b', 'c']) + call assert_equal(2, argidx()) + + call Init_abc() + 1argadd x + call Assert_argc(['a', 'x', 'b', 'c']) + call assert_equal(2, argidx()) + + call Init_abc() + $argadd x + call Assert_argc(['a', 'b', 'c', 'x']) + call assert_equal(1, argidx()) + + call Init_abc() + $argadd x + +2argadd y + call Assert_argc(['a', 'b', 'c', 'x', 'y']) + call assert_equal(1, argidx()) +endfunc + +func Init_abc() + args a b c + next +endfunc + +func Assert_argc(l) + call assert_equal(len(a:l), argc()) + let i = 0 + while i < len(a:l) && i < argc() + call assert_equal(a:l[i], argv(i)) + let i += 1 + endwhile +endfunc |