annotate src/testdir/test_arglist.vim @ 35162:860a5fb8eaf2 default tip

Added tag v9.1.0407 for changeset 08f7c9428f8224d6b24c60f4da1fd12c6354e852
author Christian Brabandt <cb@256bit.org>
date Sat, 11 May 2024 11:45:04 +0200
parents 2606fcb01157
children
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
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
3 source check.vim
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
4 source shared.vim
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
5 source term_util.vim
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
6
26169
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
7 func Reset_arglist()
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
8 args a | %argd
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
9 endfunc
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
10
7639
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 func Test_argidx()
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 args a b c
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 last
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(2, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 %argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 " 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
18 %argdelete
3335c3c75611 patch 8.0.0439: ":%argdel" gives an error for an empty arglist
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
19 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
20 call assert_fails('2argdelete', 'E16:')
7639
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 args a b c
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 next
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal(1, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 next
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(2, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal(1, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 endfunc
7647
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
35
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
36 func Test_argadd()
26169
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
37 call Reset_arglist()
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
38
7647
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
39 %argdelete
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
40 argadd a b c
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
41 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
42
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
43 %argdelete
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
44 argadd a
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
45 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
46 argadd b c d
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
47 call assert_equal(0, 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 argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
51 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
52 call assert_equal(1, 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 0argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
56 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
57 call assert_equal(2, 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 1argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
61 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
62 call assert_equal(2, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
63
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
64 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
65 $argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
66 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
67 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
68
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
69 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
70 $argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
71 +2argadd y
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
72 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
73 call assert_equal(1, argidx())
7726
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
74
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
75 %argd
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
76 edit d
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
77 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
78 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
79 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
80
976b480ced9a patch 8.0.0847: :argadd without argument can't handle space in file name
Christian Brabandt <cb@256bit.org>
parents: 11680
diff changeset
81 %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
82 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
83 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
84 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
85 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
86
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
87 %argd
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
88 new
f6311c321411 commit https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8
Christian Brabandt <cb@256bit.org>
parents: 7672
diff changeset
89 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
90 call assert_equal(0, len(argv()))
25617
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23750
diff changeset
91
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23750
diff changeset
92 if has('unix')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23750
diff changeset
93 call assert_fails('argadd `Xdoes_not_exist`', 'E479:')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23750
diff changeset
94 endif
7647
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
95 endfunc
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
96
14656
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
97 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
98 new
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
99 let curbuf = bufnr('%')
30089
0a50e536de81 patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 26719
diff changeset
100 call writefile(['test', 'Xargadd'], 'Xargadd', 'D')
14656
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
101 " 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
102 argadd Xargadd
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
103 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
104 call assert_equal('', bufname('%'))
17916
2e53305f2239 patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17855
diff changeset
105 call assert_equal(1, '$'->line())
14656
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
106 rew
17783
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17598
diff changeset
107 call assert_notequal(curbuf, '%'->bufnr())
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17598
diff changeset
108 call assert_equal('Xargadd', '%'->bufname())
14656
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
109 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
110
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
111 %argd
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
112 bwipe!
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
113 endfunc
0d5726f2913b patch 8.1.0341: :argadd in empty buffer changes the buffer name
Christian Brabandt <cb@256bit.org>
parents: 13782
diff changeset
114
7647
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
115 func Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
116 args a b c
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
117 next
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
118 endfunc
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
119
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
120 func Assert_argc(l)
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
121 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
122 let i = 0
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
123 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
124 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
125 let i += 1
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
126 endwhile
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
127 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
128
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
129 " 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
130 " 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
131 func Test_argument()
26169
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
132 call Reset_arglist()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
133
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
134 let save_hidden = &hidden
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
135 set hidden
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 let g:buffers = []
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
138 augroup TEST
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
139 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
140 augroup END
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
141
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
142 argadd a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
143 $argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
144 $-argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
145 -argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
146 1argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
147 +2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
148
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
149 augroup TEST
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
150 au!
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
151 augroup END
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
152
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
153 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
154
17478
f9a443306174 patch 8.1.1737: :args command that outputs one line gives more prompt
Bram Moolenaar <Bram@vim.org>
parents: 15290
diff changeset
155 call assert_equal("\na b [c] d ", execute(':args'))
7666
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 .argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
158 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
159
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
160 -argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
161 call assert_equal(['a', 'd'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
162
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
163 $argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
164 call assert_equal(['a'], argv())
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 1arga c
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
167 1arga b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
168 $argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
169 $arga x
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
170 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
171
7672
da2eb24b83d2 commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478
Christian Brabandt <cb@256bit.org>
parents: 7670
diff changeset
172 0arga y
da2eb24b83d2 commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478
Christian Brabandt <cb@256bit.org>
parents: 7670
diff changeset
173 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
174
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
175 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
176 call assert_equal([], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
177
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
178 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
179 2,$-argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
180 call assert_equal(['a', 'f'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
181
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
182 let &hidden = save_hidden
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
183
17524
2b35e273392b patch 8.1.1760: extra line break for wrapping output of :args
Bram Moolenaar <Bram@vim.org>
parents: 17478
diff changeset
184 let save_columns = &columns
2b35e273392b patch 8.1.1760: extra line break for wrapping output of :args
Bram Moolenaar <Bram@vim.org>
parents: 17478
diff changeset
185 let &columns = 79
21028
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
186 try
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
187 exe 'args ' .. join(range(1, 81))
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
188 call assert_equal(join([
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
189 \ '',
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
190 \ '[1] 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 ',
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
191 \ '2 7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 ',
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
192 \ '3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 ',
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
193 \ '4 9 14 19 24 29 34 39 44 49 54 59 64 69 74 79 ',
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
194 \ '5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 ',
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
195 \ ], "\n"),
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
196 \ execute('args'))
17524
2b35e273392b patch 8.1.1760: extra line break for wrapping output of :args
Bram Moolenaar <Bram@vim.org>
parents: 17478
diff changeset
197
21028
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
198 " No trailing newline with one item per row.
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
199 let long_arg = repeat('X', 81)
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
200 exe 'args ' .. long_arg
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
201 call assert_equal("\n[".long_arg.']', execute('args'))
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
202 finally
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
203 let &columns = save_columns
7acceb76669f patch 8.2.1065: Vim9: no line break allowed inside a list
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
204 endtry
17524
2b35e273392b patch 8.1.1760: extra line break for wrapping output of :args
Bram Moolenaar <Bram@vim.org>
parents: 17478
diff changeset
205
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
206 " 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
207 " changes
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
208 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
209 enew!
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
210 set modified
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
211 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
212 args! x y z
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
213 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
214 call assert_equal('x', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
215
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
216 last | enew | argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
217 call assert_equal('z', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
218
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
219 %argdelete
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
220 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
221 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
222
13732
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
223 func Test_list_arguments()
26169
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
224 call Reset_arglist()
13732
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
225
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
226 " 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
227 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
228 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
229 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
230 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
231 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
232
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
233 redir => result
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
234 args
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
235 redir END
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
236 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
237
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
238 " 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
239 exe 'argdel' aarg
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
240 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
241 exe '0argadd' aarg
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
242 redir => result
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
243 args
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
244 redir END
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
245 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
246
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
247 %argdelete
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
248 endfunc
8ca1da2a043b patch 8.0.1738: ":args" output is hard to read
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
249
15286
d2a162896a2a patch 8.1.0651: :args "foo works like :args without argument
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
250 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
251 " Only on Unix can a file name include a double quote.
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21028
diff changeset
252 CheckUnix
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21028
diff changeset
253
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21028
diff changeset
254 args \"foobar
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21028
diff changeset
255 call assert_equal('"foobar', argv(0))
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21028
diff changeset
256 %argdelete
15286
d2a162896a2a patch 8.1.0651: :args "foo works like :args without argument
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
257 endfunc
d2a162896a2a patch 8.1.0651: :args "foo works like :args without argument
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
258
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
259 " Test for 0argadd and 0argedit
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
260 " 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
261 func Test_zero_argadd()
26169
0efbf4fe6cae patch 8.2.3616: arglist test does not clear the argument list consistently
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
262 call Reset_arglist()
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 arga a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
265 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
266 0arga added
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
267 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
268
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
269 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
270 arga third
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
271 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
272
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
273 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
274 arga a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
275 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
276 0arge edited
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
277 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
278
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
279 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
280 arga third
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
281 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
282
f87c43fca41d patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents: 11173
diff changeset
283 2argu
f87c43fca41d patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents: 11173
diff changeset
284 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
285 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
286 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
287 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
288
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
289 " Test for argc()
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
290 func Test_argc()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
291 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
292 call assert_equal(0, argc())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
293 argadd a b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
294 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
295 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
296
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
297 " Test for arglistid()
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
298 func Test_arglistid()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
299 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
300 arga a b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
301 call assert_equal(0, arglistid())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
302 split
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
303 arglocal
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
304 call assert_equal(1, arglistid())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
305 tabnew | tabfirst
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
306 call assert_equal(0, arglistid(2))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
307 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
308 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
309 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
310 tabonly | only | enew!
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
311 argglobal
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
312 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
313 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
314
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
315 " 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
316 func Test_argv()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
317 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
318 call assert_equal([], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
319 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
320 call assert_equal(0, argc())
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
321 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
322 call assert_equal(4, argc())
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
323 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
324
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 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
326 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
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 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
335 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
336 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
337 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
338 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
339
2c0bfa167468 patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents: 14836
diff changeset
340 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
341 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
342 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
343
2c0bfa167468 patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents: 14836
diff changeset
344 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
345 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
346 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
347
2c0bfa167468 patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents: 14836
diff changeset
348 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
349 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
350 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
351
2c0bfa167468 patch 8.1.0493: argv() and argc() only work on the current argument list
Bram Moolenaar <Bram@vim.org>
parents: 14836
diff changeset
352 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
353 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
354 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
355 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
356 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
357 " 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
358 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
359 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
360 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
361 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
362 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
363
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
364 " 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
365 func Test_argedit()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
366 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
367 argedit a
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
368 call assert_equal(['a'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
369 call assert_equal('a', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
370 argedit b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
371 call assert_equal(['a', 'b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
372 call assert_equal('b', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
373 argedit a
11676
f87c43fca41d patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents: 11173
diff changeset
374 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
375 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
376 " 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
377 " 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
378 argedit C D
f87c43fca41d patch 8.0.0721: :argedit can only have one argument
Christian Brabandt <cb@256bit.org>
parents: 11173
diff changeset
379 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
380 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
381 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
382 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
383 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
384 else
c66d6dc92f53 patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents: 11676
diff changeset
385 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
386 endif
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
387 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
388 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
389 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
390 else
c66d6dc92f53 patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents: 11676
diff changeset
391 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
392 endif
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
393 enew! | set modified
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
394 call assert_fails('argedit y', 'E37:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
395 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
396 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
397 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
398 else
c66d6dc92f53 patch 8.0.0723: arglist test fails if file name case is ignored
Christian Brabandt <cb@256bit.org>
parents: 11676
diff changeset
399 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
400 endif
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
401 %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
402 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
403 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
404
3be5e8306a3e patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents: 13732
diff changeset
405 " :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
406 %argd
3be5e8306a3e patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents: 13732
diff changeset
407 " 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
408 bw! x
3be5e8306a3e patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents: 13732
diff changeset
409 new
17855
285f7a700185 patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
410 let a = bufnr()
13782
3be5e8306a3e patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents: 13732
diff changeset
411 argedit x
17855
285f7a700185 patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
412 call assert_equal(a, bufnr())
285f7a700185 patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
413 call assert_equal('x', bufname())
13782
3be5e8306a3e patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents: 13732
diff changeset
414 %argd
3be5e8306a3e patch 8.0.1763: :argedit does not reuse an empty unnamed buffer
Christian Brabandt <cb@256bit.org>
parents: 13732
diff changeset
415 bw! x
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
416 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
417
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
418 " Test for the :argdedupe command
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
419 func Test_argdedupe()
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
420 call Reset_arglist()
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
421 argdedupe
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
422 call assert_equal([], argv())
31061
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
423
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
424 args a a a aa b b a b aa
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
425 argdedupe
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
426 call assert_equal(['a', 'aa', 'b'], argv())
31061
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
427
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
428 args a b c
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
429 argdedupe
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
430 call assert_equal(['a', 'b', 'c'], argv())
31061
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
431
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
432 args a
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
433 argdedupe
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
434 call assert_equal(['a'], argv())
31061
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
435
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
436 args a A b B
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
437 argdedupe
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
438 if has('fname_case')
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
439 call assert_equal(['a', 'A', 'b', 'B'], argv())
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
440 else
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
441 call assert_equal(['a', 'b'], argv())
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
442 endif
31061
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
443
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
444 args a b a c a b
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
445 last
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
446 argdedupe
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
447 next
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
448 call assert_equal('c', expand('%:t'))
31061
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
449
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
450 args a ./a
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
451 argdedupe
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
452 call assert_equal(['a'], argv())
2606fcb01157 patch 9.0.0865: duplicate arguments are not always detected
Bram Moolenaar <Bram@vim.org>
parents: 30657
diff changeset
453
26719
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
454 %argd
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
455 endfunc
2bdcce61a4e4 patch 8.2.3888: the argument list may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 26715
diff changeset
456
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
457 " 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
458 func Test_argdelete()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
459 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
460 args aa a aaa b bb
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
461 argdelete a*
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
462 call assert_equal(['b', 'bb'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
463 call assert_equal('aa', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
464 last
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
465 argdelete %
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
466 call assert_equal(['b'], argv())
21845
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
467 call assert_fails('argdelete', 'E610:')
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
468 call assert_fails('1,100argdelete', 'E16:')
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21845
diff changeset
469 call assert_fails('argdel /\)/', 'E55:')
22510
7060df0b8ebf patch 8.2.1803: a few failures are not tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
470 call assert_fails('1argdel 1', 'E474:')
21845
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
471
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
472 call Reset_arglist()
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
473 args a b c d
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
474 next
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
475 argdel
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
476 call Assert_argc(['a', 'c', 'd'])
0e6ee11977b3 patch 8.2.1472: ":argdel" does not work like ":.argdel" as documented
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
477 %argdel
25617
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23750
diff changeset
478
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23750
diff changeset
479 call assert_fails('argdel does_not_exist', 'E480:')
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
480 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
481
15097
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
482 func Test_argdelete_completion()
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
483 args foo bar
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
484
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
485 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
486 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
487
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
488 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
489 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
490
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
491 %argd
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
492 endfunc
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14964
diff changeset
493
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
494 " 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
495 func Test_argpos()
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
496 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
497 args a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
498 last
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
499 call assert_equal(3, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
500 call assert_fails('next', 'E165:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
501 prev
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
502 call assert_equal(2, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
503 Next
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
504 call assert_equal(1, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
505 first
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
506 call assert_equal(0, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
507 call assert_fails('prev', 'E164:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
508 3next
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
509 call assert_equal(3, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
510 rewind
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
511 call assert_equal(0, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
512 %argd
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
513 endfunc
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
514
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
515 " 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
516 func Test_arglist_autocmd()
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
517 autocmd BufReadPost Xxx2 next Xxx2 Xxx1
30089
0a50e536de81 patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 26719
diff changeset
518 call writefile(['test file Xxx1'], 'Xxx1', 'D')
0a50e536de81 patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 26719
diff changeset
519 call writefile(['test file Xxx2'], 'Xxx2', 'D')
0a50e536de81 patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 26719
diff changeset
520 call writefile(['test file Xxx3'], 'Xxx3', 'D')
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
521
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
522 new
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
523 " redefine arglist; go to Xxx1
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
524 next! Xxx1 Xxx2 Xxx3
26713
3f8189feffb7 patch 8.2.3885: arglist test fails
Bram Moolenaar <Bram@vim.org>
parents: 26711
diff changeset
525 " open window for all args; Reading Xxx2 will try to change the arglist and
3f8189feffb7 patch 8.2.3885: arglist test fails
Bram Moolenaar <Bram@vim.org>
parents: 26711
diff changeset
526 " that will fail
3f8189feffb7 patch 8.2.3885: arglist test fails
Bram Moolenaar <Bram@vim.org>
parents: 26711
diff changeset
527 call assert_fails("all", "E1156:")
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
528 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
529 wincmd w
26713
3f8189feffb7 patch 8.2.3885: arglist test fails
Bram Moolenaar <Bram@vim.org>
parents: 26711
diff changeset
530 call assert_equal('test file Xxx2', getline(1))
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
531 wincmd w
26713
3f8189feffb7 patch 8.2.3885: arglist test fails
Bram Moolenaar <Bram@vim.org>
parents: 26711
diff changeset
532 call assert_equal('test file Xxx3', getline(1))
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
533
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
534 autocmd! BufReadPost Xxx2
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
535 enew! | only
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
536 argdelete Xxx*
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 7726
diff changeset
537 bwipe! Xxx1 Xxx2 Xxx3
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
538 endfunc
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
539
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
540 func Test_arg_all_expand()
30089
0a50e536de81 patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents: 26719
diff changeset
541 call writefile(['test file Xxx1'], 'Xx x', 'D')
11173
cc94b80016fd patch 8.0.0473: no test covering arg_all()
Christian Brabandt <cb@256bit.org>
parents: 11103
diff changeset
542 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
543 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
544 endfunc
14784
0745e2cd4606 patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents: 14656
diff changeset
545
0745e2cd4606 patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents: 14656
diff changeset
546 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
547 " 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
548 " 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
549 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
550 args
0745e2cd4606 patch 8.1.0404: accessing invalid memory with long argument name
Christian Brabandt <cb@256bit.org>
parents: 14656
diff changeset
551 endfunc
17598
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
552
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
553 func Test_argdo()
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
554 next! Xa.c Xb.c Xc.c
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
555 new
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
556 let l = []
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
557 argdo call add(l, expand('%'))
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
558 call assert_equal(['Xa.c', 'Xb.c', 'Xc.c'], l)
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
559 bwipe Xa.c Xb.c Xc.c
c1aa462d2d45 patch 8.1.1796: :argdo is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17524
diff changeset
560 endfunc
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
561
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22510
diff changeset
562 " Test for quitting Vim with unedited files in the argument list
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
563 func Test_quit_with_arglist()
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
564 CheckRunVimInTerminal
23748
93f90f2ff4e9 patch 8.2.2415: no way to check for the cmdwin feature
Bram Moolenaar <Bram@vim.org>
parents: 23744
diff changeset
565
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
566 let buf = RunVimInTerminal('', {'rows': 6})
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
567 call term_sendkeys(buf, ":set nomore\n")
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
568 call term_sendkeys(buf, ":args a b c\n")
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
569 call term_sendkeys(buf, ":quit\n")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
570 call TermWait(buf)
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
571 call WaitForAssert({-> assert_match('^E173:', term_getline(buf, 6))})
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
572 call StopVimInTerminal(buf)
19435
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
573
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
574 " Try :confirm quit with unedited files in arglist
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
575 let buf = RunVimInTerminal('', {'rows': 6})
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
576 call term_sendkeys(buf, ":set nomore\n")
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
577 call term_sendkeys(buf, ":args a b c\n")
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
578 call term_sendkeys(buf, ":confirm quit\n")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
579 call TermWait(buf)
19435
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
580 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o: *$',
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
581 \ term_getline(buf, 6))})
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
582 call term_sendkeys(buf, "N")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
583 call TermWait(buf)
19435
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
584 call term_sendkeys(buf, ":confirm quit\n")
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
585 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o: *$',
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
586 \ term_getline(buf, 6))})
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
587 call term_sendkeys(buf, "Y")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
588 call TermWait(buf)
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
589 call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
590 only!
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
591 " When this test fails, swap files are left behind which breaks subsequent
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
592 " tests
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
593 call delete('.a.swp')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
594 call delete('.b.swp')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
595 call delete('.c.swp')
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
596 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
597
23744
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
598 " Test for ":all" not working when in the cmdline window
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
599 func Test_all_not_allowed_from_cmdwin()
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
600 au BufEnter * all
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
601 next x
23750
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
602 " Use try/catch here, somehow assert_fails() doesn't work on MS-Windows
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
603 " console.
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
604 let caught = 'no'
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
605 try
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
606 exe ":norm! 7q?apat\<CR>"
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
607 catch /E11:/
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
608 let caught = 'yes'
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
609 endtry
d98dcbc57f7f patch 8.2.2416: may get stuck in command line window state
Bram Moolenaar <Bram@vim.org>
parents: 23748
diff changeset
610 call assert_equal('yes', caught)
23744
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
611 au! BufEnter
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
612 endfunc
fc031340f8f9 patch 8.2.2413: crash when using :all while using a cmdline window
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
613
26711
5860bd619d30 patch 8.2.3884: crash when clearing the argument list while using it
Bram Moolenaar <Bram@vim.org>
parents: 26169
diff changeset
614 func Test_clear_arglist_in_all()
5860bd619d30 patch 8.2.3884: crash when clearing the argument list while using it
Bram Moolenaar <Bram@vim.org>
parents: 26169
diff changeset
615 n 0 00 000 0000 00000 000000
26715
af919f98c7e1 patch 8.2.3886: can define autocmd for every event by using "au!"
Bram Moolenaar <Bram@vim.org>
parents: 26713
diff changeset
616 au WinNew 0 n 0
26713
3f8189feffb7 patch 8.2.3885: arglist test fails
Bram Moolenaar <Bram@vim.org>
parents: 26711
diff changeset
617 call assert_fails("all", "E1156")
26711
5860bd619d30 patch 8.2.3884: crash when clearing the argument list while using it
Bram Moolenaar <Bram@vim.org>
parents: 26169
diff changeset
618 au! *
5860bd619d30 patch 8.2.3884: crash when clearing the argument list while using it
Bram Moolenaar <Bram@vim.org>
parents: 26169
diff changeset
619 endfunc
5860bd619d30 patch 8.2.3884: crash when clearing the argument list while using it
Bram Moolenaar <Bram@vim.org>
parents: 26169
diff changeset
620
30172
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
621 " Test for the :all command
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
622 func Test_all_command()
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
623 %argdelete
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
624
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
625 " :all command should not close windows with files in the argument list,
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
626 " but can rearrange the windows.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
627 args Xargnew1 Xargnew2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
628 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
629 edit Xargold1
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
630 split Xargnew1
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
631 let Xargnew1_winid = win_getid()
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
632 split Xargold2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
633 split Xargnew2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
634 let Xargnew2_winid = win_getid()
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
635 split Xargold3
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
636 all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
637 call assert_equal(2, winnr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
638 call assert_equal([Xargnew1_winid, Xargnew2_winid],
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
639 \ [win_getid(1), win_getid(2)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
640 call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2')],
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
641 \ [winbufnr(1), winbufnr(2)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
642
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
643 " :all command should close windows for files which are not in the
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
644 " argument list in the current tab page.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
645 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
646 edit Xargold1
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
647 split Xargold2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
648 tabedit Xargold3
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
649 split Xargold4
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
650 tabedit Xargold5
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
651 tabfirst
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
652 all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
653 call assert_equal(3, tabpagenr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
654 call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2')], tabpagebuflist(1))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
655 call assert_equal([bufnr('Xargold4'), bufnr('Xargold3')], tabpagebuflist(2))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
656 call assert_equal([bufnr('Xargold5')], tabpagebuflist(3))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
657
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
658 " :tab all command should close windows for files which are not in the
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
659 " argument list across all the tab pages.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
660 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
661 edit Xargold1
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
662 split Xargold2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
663 tabedit Xargold3
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
664 split Xargold4
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
665 tabedit Xargold5
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
666 tabfirst
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
667 args Xargnew1 Xargnew2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
668 tab all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
669 call assert_equal(2, tabpagenr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
670 call assert_equal([bufnr('Xargnew1')], tabpagebuflist(1))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
671 call assert_equal([bufnr('Xargnew2')], tabpagebuflist(2))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
672
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
673 " If a count is specified, then :all should open only that many windows.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
674 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
675 args Xargnew1 Xargnew2 Xargnew3 Xargnew4 Xargnew5
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
676 all 3
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
677 call assert_equal(3, winnr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
678 call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2'), bufnr('Xargnew3')],
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
679 \ [winbufnr(1), winbufnr(2), winbufnr(3)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
680
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
681 " The :all command should not open more than 'tabpagemax' tab pages.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
682 " If there are more files, then they should be opened in the last tab page.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
683 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
684 set tabpagemax=3
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
685 tab all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
686 call assert_equal(3, tabpagenr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
687 call assert_equal([bufnr('Xargnew1')], tabpagebuflist(1))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
688 call assert_equal([bufnr('Xargnew2')], tabpagebuflist(2))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
689 call assert_equal([bufnr('Xargnew3'), bufnr('Xargnew4'), bufnr('Xargnew5')],
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
690 \ tabpagebuflist(3))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
691 set tabpagemax&
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
692
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
693 " Without the 'hidden' option, modified buffers should not be closed.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
694 args Xargnew1 Xargnew2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
695 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
696 edit Xargtemp1
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
697 call setline(1, 'temp buffer 1')
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
698 split Xargtemp2
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
699 call setline(1, 'temp buffer 2')
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
700 all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
701 call assert_equal(4, winnr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
702 call assert_equal([bufnr('Xargtemp2'), bufnr('Xargtemp1'), bufnr('Xargnew1'),
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
703 \ bufnr('Xargnew2')],
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
704 \ [winbufnr(1), winbufnr(2), winbufnr(3), winbufnr(4)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
705
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
706 " With the 'hidden' option set, both modified and unmodified buffers in
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
707 " closed windows should be hidden.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
708 set hidden
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
709 all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
710 call assert_equal(2, winnr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
711 call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2')],
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
712 \ [winbufnr(1), winbufnr(2)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
713 call assert_equal([1, 1, 0, 0], [getbufinfo('Xargtemp1')[0].hidden,
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
714 \ getbufinfo('Xargtemp2')[0].hidden,
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
715 \ getbufinfo('Xargnew1')[0].hidden,
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
716 \ getbufinfo('Xargnew2')[0].hidden])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
717 set nohidden
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
718
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
719 " When 'winheight' is set to a large value, :all should open only one
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
720 " window.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
721 args Xargnew1 Xargnew2 Xargnew3 Xargnew4 Xargnew5
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
722 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
723 set winheight=9999
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
724 call assert_fails('all', 'E36:')
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
725 call assert_equal([1, bufnr('Xargnew1')], [winnr('$'), winbufnr(1)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
726 set winheight&
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
727
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
728 " When 'winwidth' is set to a large value, :vert all should open only one
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
729 " window.
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
730 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
731 set winwidth=9999
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
732 call assert_fails('vert all', 'E36:')
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
733 call assert_equal([1, bufnr('Xargnew1')], [winnr('$'), winbufnr(1)])
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
734 set winwidth&
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
735
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
736 " empty argument list tests
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
737 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
738 %argdelete
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
739 call assert_equal('', execute('args'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
740 all
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
741 call assert_equal(1, winnr('$'))
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
742
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
743 %argdelete
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
744 %bw!
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
745 endfunc
c684e9381495 patch 9.0.0422: not enough testing of the :all command
Bram Moolenaar <Bram@vim.org>
parents: 30089
diff changeset
746
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
747 " vim: shiftwidth=2 sts=2 expandtab