annotate src/testdir/test_arglist.vim @ 7672:da2eb24b83d2 v7.4.1135

commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 19 14:14:08 2016 +0100 patch 7.4.1135 Problem: One more arglist test fails on MS-Windows. Solution: Don't edit "Y" after editing "y".
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Jan 2016 14:15:05 +0100
parents fd31843c7b58
children f6311c321411
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7639
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test argument list commands
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_argidx()
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 args a b c
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 last
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call assert_equal(2, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 %argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 args a b c
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 next
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal(1, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 next
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal(2, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal(1, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 1argdelete
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal(0, argidx())
0ecb62a66a7a commit https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endfunc
7647
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
23
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
24 func Test_argadd()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
25 %argdelete
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
26 argadd a b c
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
27 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
28
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
29 %argdelete
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
30 argadd a
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
31 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
32 argadd b c d
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
33 call assert_equal(0, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
34
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
35 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
36 argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
37 call Assert_argc(['a', 'b', 'x', 'c'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
38 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
39
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
40 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
41 0argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
42 call Assert_argc(['x', 'a', 'b', 'c'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
43 call assert_equal(2, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
44
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
45 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
46 1argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
47 call Assert_argc(['a', 'x', 'b', 'c'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
48 call assert_equal(2, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
49
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
50 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
51 $argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
52 call Assert_argc(['a', 'b', 'c', 'x'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
53 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
54
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
55 call Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
56 $argadd x
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
57 +2argadd y
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
58 call Assert_argc(['a', 'b', 'c', 'x', 'y'])
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
59 call assert_equal(1, argidx())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
60 endfunc
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
61
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
62 func Init_abc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
63 args a b c
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
64 next
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
65 endfunc
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
66
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
67 func Assert_argc(l)
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
68 call assert_equal(len(a:l), argc())
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
69 let i = 0
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
70 while i < len(a:l) && i < argc()
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
71 call assert_equal(a:l[i], argv(i))
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
72 let i += 1
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
73 endwhile
65b2d593c203 commit https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec
Christian Brabandt <cb@256bit.org>
parents: 7639
diff changeset
74 endfunc
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
75
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
76 " 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
77 " Ported from the test_argument_count.in test script
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
78 function Test_argument()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
79 " Clean the argument list
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
80 arga a | %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
81
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
82 let save_hidden = &hidden
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
83 set hidden
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
84
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
85 let g:buffers = []
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
86 augroup TEST
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
87 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
88 augroup END
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
89
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
90 argadd a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
91 $argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
92 $-argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
93 -argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
94 1argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
95 +2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
96
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
97 augroup TEST
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
98 au!
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
99 augroup END
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
100
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
101 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
102
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
103 redir => result
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
104 ar
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
105 redir END
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
106 call assert_true(result =~# 'a b \[c] d')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
107
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
108 .argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
109 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
110
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
111 -argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
112 call assert_equal(['a', 'd'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
113
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
114 $argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
115 call assert_equal(['a'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
116
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
117 1arga c
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
118 1arga b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
119 $argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
120 $arga x
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
121 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
122
7672
da2eb24b83d2 commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478
Christian Brabandt <cb@256bit.org>
parents: 7670
diff changeset
123 0arga y
da2eb24b83d2 commit https://github.com/vim/vim/commit/301417041bdb15264a9c8ff20e4fea4dcc12c478
Christian Brabandt <cb@256bit.org>
parents: 7670
diff changeset
124 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
125
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
126 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
127 call assert_equal([], argv())
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 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
130 2,$-argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
131 call assert_equal(['a', 'f'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
132
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
133 let &hidden = save_hidden
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
134
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
135 " 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
136 " changes
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
137 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
138 enew!
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
139 set modified
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
140 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
141 args! x y z
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
142 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
143 call assert_equal('x', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
144
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
145 last | enew | argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
146 call assert_equal('z', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
147
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
148 %argdelete
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
149 call assert_fails('argument', 'E163:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
150 endfunction
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
151
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
152 " Test for 0argadd and 0argedit
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
153 " Ported from the test_argument_0count.in test script
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
154 function Test_zero_argadd()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
155 " Clean the argument list
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
156 arga a | %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
157
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
158 arga a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
159 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
160 0arga added
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
161 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
162
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
163 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
164 arga third
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
165 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
166
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
167 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
168 arga a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
169 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
170 0arge edited
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
171 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
172
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
173 2argu
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
174 arga third
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
175 call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
176 endfunction
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 function Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
179 args a | %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
180 endfunction
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 " Test for argc()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
183 function Test_argc()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
184 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
185 call assert_equal(0, argc())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
186 argadd a b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
187 call assert_equal(2, argc())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
188 endfunction
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
189
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
190 " Test for arglistid()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
191 function Test_arglistid()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
192 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
193 arga a b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
194 call assert_equal(0, arglistid())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
195 split
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
196 arglocal
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
197 call assert_equal(1, arglistid())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
198 tabnew | tabfirst
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
199 call assert_equal(0, arglistid(2))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
200 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
201 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
202 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
203 tabonly | only | enew!
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
204 argglobal
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
205 call assert_equal(0, arglistid())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
206 endfunction
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
207
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
208 " Test for argv()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
209 function Test_argv()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
210 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
211 call assert_equal([], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
212 call assert_equal("", argv(2))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
213 argadd a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
214 call assert_equal('c', argv(2))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
215 endfunction
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
216
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
217 " Test for the :argedit command
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
218 function Test_argedit()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
219 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
220 argedit a
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
221 call assert_equal(['a'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
222 call assert_equal('a', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
223 argedit b
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
224 call assert_equal(['a', 'b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
225 call assert_equal('b', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
226 argedit a
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
227 call assert_equal(['a', 'b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
228 call assert_equal('a', expand('%:t'))
7670
fd31843c7b58 commit https://github.com/vim/vim/commit/82e4184d489e2ce950c871354062fca40bf59598
Christian Brabandt <cb@256bit.org>
parents: 7666
diff changeset
229 if has('unix')
fd31843c7b58 commit https://github.com/vim/vim/commit/82e4184d489e2ce950c871354062fca40bf59598
Christian Brabandt <cb@256bit.org>
parents: 7666
diff changeset
230 " on MS-Windows this would edit file "a b"
fd31843c7b58 commit https://github.com/vim/vim/commit/82e4184d489e2ce950c871354062fca40bf59598
Christian Brabandt <cb@256bit.org>
parents: 7666
diff changeset
231 call assert_fails('argedit a b', 'E172:')
fd31843c7b58 commit https://github.com/vim/vim/commit/82e4184d489e2ce950c871354062fca40bf59598
Christian Brabandt <cb@256bit.org>
parents: 7666
diff changeset
232 endif
7666
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
233 argedit c
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
234 call assert_equal(['a', 'c', 'b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
235 0argedit x
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
236 call assert_equal(['x', 'a', 'c', 'b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
237 enew! | set modified
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
238 call assert_fails('argedit y', 'E37:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
239 argedit! y
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
240 call assert_equal(['x', 'y', 'a', 'c', 'b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
241 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
242 endfunction
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
243
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
244 " Test for the :argdelete command
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
245 function Test_argdelete()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
246 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
247 args aa a aaa b bb
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
248 argdelete a*
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
249 call assert_equal(['b', 'bb'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
250 call assert_equal('aa', expand('%:t'))
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
251 last
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
252 argdelete %
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
253 call assert_equal(['b'], argv())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
254 call assert_fails('argdelete', 'E471:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
255 call assert_fails('1,100argdelete', 'E16:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
256 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
257 endfunction
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
258
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
259 " Tests for the :next, :prev, :first, :last, :rewind commands
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
260 function Test_argpos()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
261 call Reset_arglist()
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
262 args a b c d
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
263 last
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
264 call assert_equal(3, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
265 call assert_fails('next', 'E165:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
266 prev
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
267 call assert_equal(2, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
268 Next
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
269 call assert_equal(1, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
270 first
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
271 call assert_equal(0, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
272 call assert_fails('prev', 'E164:')
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
273 3next
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
274 call assert_equal(3, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
275 rewind
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
276 call assert_equal(0, argidx())
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
277 %argd
8edd1afaf6b7 commit https://github.com/vim/vim/commit/99dbe291f55022bd5166c9c3c7967b8693cd9d1b
Christian Brabandt <cb@256bit.org>
parents: 7647
diff changeset
278 endfunction