annotate src/testdir/test_arglist.vim @ 7647:65b2d593c203 v7.4.1123

commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 17 19:39:00 2016 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Jan 2016 19:45:04 +0100
parents 0ecb62a66a7a
children 8edd1afaf6b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7639
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test argument list commands
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_argidx()
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 args a b c
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 last
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call assert_equal(2, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 %argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 args a b c
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 next
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal(1, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 next
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal(2, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal(1, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endfunc
7647
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
23
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
24 func Test_argadd()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
25 %argdelete
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
26 argadd a b c
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
27 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
28
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
29 %argdelete
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
30 argadd a
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
31 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
32 argadd b c d
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
33 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
34
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
35 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
36 argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
37 call Assert_argc(['a', 'b', 'x', 'c'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
38 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
39
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
40 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
41 0argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
42 call Assert_argc(['x', 'a', 'b', 'c'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
43 call assert_equal(2, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
44
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
45 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
46 1argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
47 call Assert_argc(['a', 'x', 'b', 'c'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
48 call assert_equal(2, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
49
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
50 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
51 $argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
52 call Assert_argc(['a', 'b', 'c', 'x'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
53 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
54
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
55 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
56 $argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
57 +2argadd y
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
58 call Assert_argc(['a', 'b', 'c', 'x', 'y'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
59 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
60 endfunc
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
61
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
62 func Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
63 args a b c
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
64 next
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
65 endfunc
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
66
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
67 func Assert_argc(l)
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
68 call assert_equal(len(a:l), argc())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
69 let i = 0
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
70 while i < len(a:l) && i < argc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
71 call assert_equal(a:l[i], argv(i))
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
72 let i += 1
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
73 endwhile
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
74 endfunc