Mercurial > vim
annotate src/testdir/test_arglist.vim @ 15450:bb421f682528 v8.1.0733
patch 8.1.0733: too many #ifdefs for the multi-byte feature
commit https://github.com/vim/vim/commit/2be7cb73f66cf69659195d9a8ad4beaa359f2865
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 12 16:10:51 2019 +0100
patch 8.1.0733: too many #ifdefs for the multi-byte feature
Problem: Too many #ifdefs for the multi-byte feature.
Solution: Tentatively always enable the multi-byte feature. If you have a
problem with this, please discuss on the Vim maillist.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Jan 2019 16:15:04 +0100 |
parents | 424f2596f582 |
children | f9a443306174 |
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()) |
11103
3335c3c75611
patch 8.0.0439: ":%argdel" gives an error for an empty arglist
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
9 " doing it again doesn't result in an error |
3335c3c75611
patch 8.0.0439: ":%argdel" gives an error for an empty arglist
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
10 %argdelete |
3335c3c75611
patch 8.0.0439: ":%argdel" gives an error for an empty arglist
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
11 call assert_equal(0, argidx()) |
3335c3c75611
patch 8.0.0439: ":%argdel" gives an error for an empty arglist
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
12 call assert_fails('2argdelete', 'E16:') |
7639
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 args a b c |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_equal(0, argidx()) |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 next |
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 next |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal(2, 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(1, argidx()) |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 1argdelete |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal(0, argidx()) |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 1argdelete |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal(0, argidx()) |
0ecb62a66a7a
commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endfunc |
7647
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
27 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
28 func Test_argadd() |
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 b c |
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 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
33 %argdelete |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
34 argadd a |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
35 call assert_equal(0, argidx()) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
36 argadd b c d |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
37 call assert_equal(0, argidx()) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
38 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
39 call Init_abc() |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
40 argadd x |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
41 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
|
42 call assert_equal(1, argidx()) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
43 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
44 call Init_abc() |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
45 0argadd x |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
46 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
|
47 call assert_equal(2, argidx()) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
48 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
49 call Init_abc() |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
50 1argadd x |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
51 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
|
52 call assert_equal(2, argidx()) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
53 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
54 call Init_abc() |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
55 $argadd x |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
56 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
|
57 call assert_equal(1, argidx()) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
58 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
59 call Init_abc() |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
60 $argadd x |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
61 +2argadd y |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
62 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
|
63 call assert_equal(1, argidx()) |
7726
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
64 |
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
65 %argd |
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
66 edit d |
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
67 arga |
11935
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
68 call assert_equal(1, len(argv())) |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
69 call assert_equal('d', get(argv(), 0, '')) |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
70 |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
71 %argd |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
72 edit some\ file |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
73 arga |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
74 call assert_equal(1, len(argv())) |
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
75 call assert_equal('some file', get(argv(), 0, '')) |
7726
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
76 |
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
77 %argd |
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
78 new |
f6311c321411
commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents:
7672
diff
changeset
|
79 arga |
11935
976b480ced9a
patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents:
11680
diff
changeset
|
80 call assert_equal(0, len(argv())) |
7647
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
81 endfunc |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
82 |
14656
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
83 func Test_argadd_empty_curbuf() |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
84 new |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
85 let curbuf = bufnr('%') |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
86 call writefile(['test', 'Xargadd'], 'Xargadd') |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
87 " must not re-use the current buffer. |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
88 argadd Xargadd |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
89 call assert_equal(curbuf, bufnr('%')) |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
90 call assert_equal('', bufname('%')) |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
91 call assert_equal(1, line('$')) |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
92 rew |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
93 call assert_notequal(curbuf, bufnr('%')) |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
94 call assert_equal('Xargadd', bufname('%')) |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
95 call assert_equal(2, line('$')) |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
96 |
14836
516fc9fc4f1f
patch 8.1.0430: Xargadd file left behind after running test
Christian Brabandt <cb@256bit.org>
parents:
14784
diff
changeset
|
97 call delete('Xargadd') |
14656
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
98 %argd |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
99 bwipe! |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
100 endfunc |
0d5726f2913b
patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents:
13782
diff
changeset
|
101 |
7647
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
102 func Init_abc() |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
103 args a b c |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
104 next |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
105 endfunc |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
106 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
107 func Assert_argc(l) |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
108 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
|
109 let i = 0 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
110 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
|
111 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
|
112 let i += 1 |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
113 endwhile |
65b2d593c203
commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents:
7639
diff
changeset
|
114 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
115 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
116 " Test for [count]argument and [count]argdelete commands |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
117 " Ported from the test_argument_count.in test script |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
118 func Test_argument() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
119 " Clean the argument list |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
120 arga a | %argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
121 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
122 let save_hidden = &hidden |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
123 set hidden |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
124 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
125 let g:buffers = [] |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
126 augroup TEST |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
127 au BufEnter * call add(buffers, expand('%:t')) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
128 augroup END |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
129 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
130 argadd a b c d |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
131 $argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
132 $-argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
133 -argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
134 1argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
135 +2argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
136 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
137 augroup TEST |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
138 au! |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
139 augroup END |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
140 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
141 call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
142 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
143 redir => result |
13732
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
144 args |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
145 redir END |
13732
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
146 call assert_equal('a b [c] d', trim(result)) |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
147 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
148 .argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
149 call assert_equal(['a', 'b', 'd'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
150 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
151 -argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
152 call assert_equal(['a', 'd'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
153 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
154 $argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
155 call assert_equal(['a'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
156 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
157 1arga c |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
158 1arga b |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
159 $argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
160 $arga x |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
161 call assert_equal(['a', 'b', 'c', 'x'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
162 |
7672
da2eb24b83d2
commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478
Christian Brabandt <cb@256bit.org>
parents:
7670
diff
changeset
|
163 0arga y |
da2eb24b83d2
commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478
Christian Brabandt <cb@256bit.org>
parents:
7670
diff
changeset
|
164 call assert_equal(['y', 'a', 'b', 'c', 'x'], argv()) |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
165 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
166 %argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
167 call assert_equal([], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
168 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
169 arga a b c d e f |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
170 2,$-argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
171 call assert_equal(['a', 'f'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
172 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
173 let &hidden = save_hidden |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
174 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
175 " Setting argument list should fail when the current buffer has unsaved |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
176 " changes |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
177 %argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
178 enew! |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
179 set modified |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
180 call assert_fails('args x y z', 'E37:') |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
181 args! x y z |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
182 call assert_equal(['x', 'y', 'z'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
183 call assert_equal('x', expand('%:t')) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
184 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
185 last | enew | argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
186 call assert_equal('z', expand('%:t')) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
187 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
188 %argdelete |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
189 call assert_fails('argument', 'E163:') |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
190 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
191 |
13732
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
192 func Test_list_arguments() |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
193 " Clean the argument list |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
194 arga a | %argd |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
195 |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
196 " four args half the screen width makes two lines with two columns |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
197 let aarg = repeat('a', &columns / 2 - 4) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
198 let barg = repeat('b', &columns / 2 - 4) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
199 let carg = repeat('c', &columns / 2 - 4) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
200 let darg = repeat('d', &columns / 2 - 4) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
201 exe 'argadd ' aarg barg carg darg |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
202 |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
203 redir => result |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
204 args |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
205 redir END |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
206 call assert_match('\[' . aarg . '] \+' . carg . '\n' . barg . ' \+' . darg, trim(result)) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
207 |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
208 " if one arg is longer than half the screen make one column |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
209 exe 'argdel' aarg |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
210 let aarg = repeat('a', &columns / 2 + 2) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
211 exe '0argadd' aarg |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
212 redir => result |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
213 args |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
214 redir END |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
215 call assert_match(aarg . '\n\[' . barg . ']\n' . carg . '\n' . darg, trim(result)) |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
216 |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
217 %argdelete |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
218 endfunc |
8ca1da2a043b
patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
219 |
15286
d2a162896a2a
patch 8.1.0651: :args "foo works like :args without argument
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
220 func Test_args_with_quote() |
15290
424f2596f582
patch 8.1.0653: arglist test fails on MS-windows
Bram Moolenaar <Bram@vim.org>
parents:
15286
diff
changeset
|
221 " Only on Unix can a file name include a double quote. |
424f2596f582
patch 8.1.0653: arglist test fails on MS-windows
Bram Moolenaar <Bram@vim.org>
parents:
15286
diff
changeset
|
222 if has('unix') |
424f2596f582
patch 8.1.0653: arglist test fails on MS-windows
Bram Moolenaar <Bram@vim.org>
parents:
15286
diff
changeset
|
223 args \"foobar |
424f2596f582
patch 8.1.0653: arglist test fails on MS-windows
Bram Moolenaar <Bram@vim.org>
parents:
15286
diff
changeset
|
224 call assert_equal('"foobar', argv(0)) |
424f2596f582
patch 8.1.0653: arglist test fails on MS-windows
Bram Moolenaar <Bram@vim.org>
parents:
15286
diff
changeset
|
225 %argdelete |
424f2596f582
patch 8.1.0653: arglist test fails on MS-windows
Bram Moolenaar <Bram@vim.org>
parents:
15286
diff
changeset
|
226 endif |
15286
d2a162896a2a
patch 8.1.0651: :args "foo works like :args without argument
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
227 endfunc |
d2a162896a2a
patch 8.1.0651: :args "foo works like :args without argument
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
228 |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
229 " Test for 0argadd and 0argedit |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
230 " Ported from the test_argument_0count.in test script |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
231 func Test_zero_argadd() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
232 " Clean the argument list |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
233 arga a | %argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
234 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
235 arga a b c d |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
236 2argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
237 0arga added |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
238 call assert_equal(['added', 'a', 'b', 'c', 'd'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
239 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
240 2argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
241 arga third |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
242 call assert_equal(['added', 'a', 'third', 'b', 'c', 'd'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
243 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
244 %argd |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
245 arga a b c d |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
246 2argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
247 0arge edited |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
248 call assert_equal(['edited', 'a', 'b', 'c', 'd'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
249 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
250 2argu |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
251 arga third |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
252 call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv()) |
11676
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
253 |
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
254 2argu |
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
255 argedit file\ with\ spaces another file |
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
256 call assert_equal(['edited', 'a', 'file with spaces', 'another', 'file', 'third', 'b', 'c', 'd'], argv()) |
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
257 call assert_equal('file with spaces', expand('%')) |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
258 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
259 |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
260 func Reset_arglist() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
261 args a | %argd |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
262 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
263 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
264 " Test for argc() |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
265 func Test_argc() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
266 call Reset_arglist() |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
267 call assert_equal(0, argc()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
268 argadd a b |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
269 call assert_equal(2, argc()) |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
270 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
271 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
272 " Test for arglistid() |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
273 func Test_arglistid() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
274 call Reset_arglist() |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
275 arga a b |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
276 call assert_equal(0, arglistid()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
277 split |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
278 arglocal |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
279 call assert_equal(1, arglistid()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
280 tabnew | tabfirst |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
281 call assert_equal(0, arglistid(2)) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
282 call assert_equal(1, arglistid(1, 1)) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
283 call assert_equal(0, arglistid(2, 1)) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
284 call assert_equal(1, arglistid(1, 2)) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
285 tabonly | only | enew! |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
286 argglobal |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
287 call assert_equal(0, arglistid()) |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
288 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
289 |
14964
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
290 " Tests for argv() and argc() |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
291 func Test_argv() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
292 call Reset_arglist() |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
293 call assert_equal([], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
294 call assert_equal("", argv(2)) |
14964
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
295 call assert_equal(0, argc()) |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
296 argadd a b c d |
14964
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
297 call assert_equal(4, argc()) |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
298 call assert_equal('c', argv(2)) |
14964
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
299 |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
300 let w1_id = win_getid() |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
301 split |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
302 let w2_id = win_getid() |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
303 arglocal |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
304 args e f g |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
305 tabnew |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
306 let w3_id = win_getid() |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
307 split |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
308 let w4_id = win_getid() |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
309 argglobal |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
310 tabfirst |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
311 call assert_equal(4, argc(w1_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
312 call assert_equal('b', argv(1, w1_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
313 call assert_equal(['a', 'b', 'c', 'd'], argv(-1, w1_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
314 |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
315 call assert_equal(3, argc(w2_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
316 call assert_equal('f', argv(1, w2_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
317 call assert_equal(['e', 'f', 'g'], argv(-1, w2_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
318 |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
319 call assert_equal(3, argc(w3_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
320 call assert_equal('e', argv(0, w3_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
321 call assert_equal(['e', 'f', 'g'], argv(-1, w3_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
322 |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
323 call assert_equal(4, argc(w4_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
324 call assert_equal('c', argv(2, w4_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
325 call assert_equal(['a', 'b', 'c', 'd'], argv(-1, w4_id)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
326 |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
327 call assert_equal(4, argc(-1)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
328 call assert_equal(3, argc()) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
329 call assert_equal('d', argv(3, -1)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
330 call assert_equal(['a', 'b', 'c', 'd'], argv(-1, -1)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
331 tabonly | only | enew! |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
332 " Negative test cases |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
333 call assert_equal(-1, argc(100)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
334 call assert_equal('', argv(1, 100)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
335 call assert_equal([], argv(-1, 100)) |
2c0bfa167468
patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents:
14836
diff
changeset
|
336 call assert_equal('', argv(10, -1)) |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
337 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
338 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
339 " Test for the :argedit command |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
340 func Test_argedit() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
341 call Reset_arglist() |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
342 argedit a |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
343 call assert_equal(['a'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
344 call assert_equal('a', expand('%:t')) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
345 argedit b |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
346 call assert_equal(['a', 'b'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
347 call assert_equal('b', expand('%:t')) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
348 argedit a |
11676
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
349 call assert_equal(['a', 'b', 'a'], argv()) |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
350 call assert_equal('a', expand('%:t')) |
11680
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
351 " When file name case is ignored, an existing buffer with only case |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
11935
diff
changeset
|
352 " difference is re-used. |
11676
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
353 argedit C D |
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
354 call assert_equal('C', expand('%:t')) |
f87c43fca41d
patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents:
11173
diff
changeset
|
355 call assert_equal(['a', 'b', 'a', 'C', 'D'], argv()) |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
356 argedit c |
11680
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
357 if has('fname_case') |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
358 call assert_equal(['a', 'b', 'a', 'C', 'c', 'D'], argv()) |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
359 else |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
360 call assert_equal(['a', 'b', 'a', 'C', 'C', 'D'], argv()) |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
361 endif |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
362 0argedit x |
11680
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
363 if has('fname_case') |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
364 call assert_equal(['x', 'a', 'b', 'a', 'C', 'c', 'D'], argv()) |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
365 else |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
366 call assert_equal(['x', 'a', 'b', 'a', 'C', 'C', 'D'], argv()) |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
367 endif |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
368 enew! | set modified |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
369 call assert_fails('argedit y', 'E37:') |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
370 argedit! y |
11680
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
371 if has('fname_case') |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
372 call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'c', 'D'], argv()) |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
373 else |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
374 call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'C', 'D'], argv()) |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
375 endif |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
376 %argd |
11680
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
377 bwipe! C |
c66d6dc92f53
patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents:
11676
diff
changeset
|
378 bwipe! D |
13782
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
379 |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
380 " :argedit reuses the current buffer if it is empty |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
381 %argd |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
382 " make sure to use a new buffer number for x when it is loaded |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
383 bw! x |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
384 new |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
385 let a = bufnr('') |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
386 argedit x |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
387 call assert_equal(a, bufnr('')) |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
388 call assert_equal('x', bufname('')) |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
389 %argd |
3be5e8306a3e
patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents:
13732
diff
changeset
|
390 bw! x |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
391 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
392 |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
393 " Test for the :argdelete command |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
394 func Test_argdelete() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
395 call Reset_arglist() |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
396 args aa a aaa b bb |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
397 argdelete a* |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
398 call assert_equal(['b', 'bb'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
399 call assert_equal('aa', expand('%:t')) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
400 last |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
401 argdelete % |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
402 call assert_equal(['b'], argv()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
403 call assert_fails('argdelete', 'E471:') |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
404 call assert_fails('1,100argdelete', 'E16:') |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
405 %argd |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
406 endfunc |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
407 |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
408 func Test_argdelete_completion() |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
409 args foo bar |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
410 |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
411 call feedkeys(":argdelete \<C-A>\<C-B>\"\<CR>", 'tx') |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
412 call assert_equal('"argdelete bar foo', @:) |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
413 |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
414 call feedkeys(":argdelete x \<C-A>\<C-B>\"\<CR>", 'tx') |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
415 call assert_equal('"argdelete x bar foo', @:) |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
416 |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
417 %argd |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
418 endfunc |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14964
diff
changeset
|
419 |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
420 " Tests for the :next, :prev, :first, :last, :rewind commands |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
421 func Test_argpos() |
7666
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
422 call Reset_arglist() |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
423 args a b c d |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
424 last |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
425 call assert_equal(3, argidx()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
426 call assert_fails('next', 'E165:') |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
427 prev |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
428 call assert_equal(2, argidx()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
429 Next |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
430 call assert_equal(1, argidx()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
431 first |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
432 call assert_equal(0, argidx()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
433 call assert_fails('prev', 'E164:') |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
434 3next |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
435 call assert_equal(3, argidx()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
436 rewind |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
437 call assert_equal(0, argidx()) |
8edd1afaf6b7
commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents:
7647
diff
changeset
|
438 %argd |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
439 endfunc |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
440 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
441 " Test for autocommand that redefines the argument list, when doing ":all". |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
442 func Test_arglist_autocmd() |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
443 autocmd BufReadPost Xxx2 next Xxx2 Xxx1 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
444 call writefile(['test file Xxx1'], 'Xxx1') |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
445 call writefile(['test file Xxx2'], 'Xxx2') |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
446 call writefile(['test file Xxx3'], 'Xxx3') |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
447 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
448 new |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
449 " redefine arglist; go to Xxx1 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
450 next! Xxx1 Xxx2 Xxx3 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
451 " open window for all args |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
452 all |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
453 call assert_equal('test file Xxx1', getline(1)) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
454 wincmd w |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
455 wincmd w |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
456 call assert_equal('test file Xxx1', getline(1)) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
457 " should now be in Xxx2 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
458 rewind |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
459 call assert_equal('test file Xxx2', getline(1)) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
460 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
461 autocmd! BufReadPost Xxx2 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
462 enew! | only |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
463 call delete('Xxx1') |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
464 call delete('Xxx2') |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
465 call delete('Xxx3') |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
466 argdelete Xxx* |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
7726
diff
changeset
|
467 bwipe! Xxx1 Xxx2 Xxx3 |
11173
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
468 endfunc |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
469 |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
470 func Test_arg_all_expand() |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
471 call writefile(['test file Xxx1'], 'Xx x') |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
472 next notexist Xx\ x runtest.vim |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
473 call assert_equal('notexist Xx\ x runtest.vim', expand('##')) |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
474 call delete('Xx x') |
cc94b80016fd
patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents:
11103
diff
changeset
|
475 endfunc |
14784
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
476 |
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
477 func Test_large_arg() |
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
478 " Argument longer or equal to the number of columns used to cause |
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
479 " access to invalid memory. |
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
480 exe 'argadd ' .repeat('x', &columns) |
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
481 args |
0745e2cd4606
patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents:
14656
diff
changeset
|
482 endfunc |