annotate src/testdir/test60.in @ 8184:1f81c571d0e7 v7.4.1385

commit https://github.com/vim/vim/commit/5e83840756f6bb446d5cd8d026c1430b203645f1 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 21 23:12:41 2016 +0100 patch 7.4.1385 Problem: Compiler warning for using array. Solution: Use the right member name. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 21 Feb 2016 23:15:05 +0100
parents a44087db7238
children 03e5171c23e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5784
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
1 Tests for the exists() and has() functions. vim: set ft=vim ts=8 sw=2 :
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
2
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
3 STARTTEST
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
4 :so small.vim
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
5 :function! RunTest(str, result)
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
6 if exists(a:str) == a:result
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
7 echo "OK"
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
8 else
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
9 echo "FAILED: Checking for " . a:str
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
10 endif
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
11 endfunction
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
12 :function! TestExists()
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
13 augroup myagroup
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
14 autocmd! BufEnter *.my echo "myfile edited"
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
15 autocmd! FuncUndefined UndefFun exec "fu UndefFun()\nendfu"
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
16 augroup END
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
17 set rtp+=./sautest
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
18
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
19 let test_cases = []
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
20
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
21 " valid autocmd group
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
22 let test_cases += [['#myagroup', 1]]
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
23 " valid autocmd group with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
24 let test_cases += [['#myagroup+b', 0]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
25 " Valid autocmd group and event
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
26 let test_cases += [['#myagroup#BufEnter', 1]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
27 " Valid autocmd group, event and pattern
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
28 let test_cases += [['#myagroup#BufEnter#*.my', 1]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
29 " Valid autocmd event
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
30 let test_cases += [['#BufEnter', 1]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
31 " Valid autocmd event and pattern
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
32 let test_cases += [['#BufEnter#*.my', 1]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
33 " Non-existing autocmd group or event
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
34 let test_cases += [['#xyzagroup', 0]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
35 " Non-existing autocmd group and valid autocmd event
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
36 let test_cases += [['#xyzagroup#BufEnter', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
37 " Valid autocmd group and event with no matching pattern
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
38 let test_cases += [['#myagroup#CmdwinEnter', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
39 " Valid autocmd group and non-existing autocmd event
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
40 let test_cases += [['#myagroup#xyzacmd', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
41 " Valid autocmd group and event and non-matching pattern
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
42 let test_cases += [['#myagroup#BufEnter#xyzpat', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
43 " Valid autocmd event and non-matching pattern
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
44 let test_cases += [['#BufEnter#xyzpat', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
45 " Empty autocmd group, event and pattern
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
46 let test_cases += [['###', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
47 " Empty autocmd group and event or empty event and pattern
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
48 let test_cases += [['##', 0]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
49 " Valid autocmd event
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
50 let test_cases += [['##FileReadCmd', 1]]
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
51 " Non-existing autocmd event
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
52 let test_cases += [['##MySpecialCmd', 0]]
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
53
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
54 " Existing and working option (long form)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
55 let test_cases += [['&textwidth', 1]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
56 " Existing and working option (short form)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
57 let test_cases += [['&tw', 1]]
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
58 " Existing and working option with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
59 let test_cases += [['&tw-', 0]]
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
60 " Global option
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
61 let test_cases += [['&g:errorformat', 1]]
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
62 " Local option
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
63 let test_cases += [['&l:errorformat', 1]]
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
64 " Negative form of existing and working option (long form)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
65 let test_cases += [['&nojoinspaces', 0]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
66 " Negative form of existing and working option (short form)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
67 let test_cases += [['&nojs', 0]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
68 " Non-existing option
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
69 let test_cases += [['&myxyzoption', 0]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
70
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
71 " Existing and working option (long form)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
72 let test_cases += [['+incsearch', 1]]
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
73 " Existing and working option with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
74 let test_cases += [['+incsearch!1', 0]]
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
75 " Existing and working option (short form)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
76 let test_cases += [['+is', 1]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
77 " Existing option that is hidden.
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
78 let test_cases += [['+autoprint', 0]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
79
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
80 " Existing environment variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
81 let $EDITOR_NAME = 'Vim Editor'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
82 let test_cases += [['$EDITOR_NAME', 1]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
83 " Non-existing environment variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
84 let test_cases += [['$NON_ENV_VAR', 0]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
85
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
86 " Valid internal function
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
87 let test_cases += [['*bufnr', 1]]
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
88 " Valid internal function with ()
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
89 let test_cases += [['*bufnr()', 1]]
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
90 " Non-existing internal function
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
91 let test_cases += [['*myxyzfunc', 0]]
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
92 " Valid internal function with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
93 let test_cases += [['*bufnr&6', 0]]
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
94
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
95 " Valid user defined function
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
96 let test_cases += [['*TestExists', 1]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
97 " Non-existing user defined function
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
98 let test_cases += [['*MyxyzFunc', 0]]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
99
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
100 " Function that may be created by FuncUndefined event
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
101 let test_cases += [['*UndefFun', 0]]
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
102 " Function that may be created by script autoloading
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
103 let test_cases += [['*footest#F', 0]]
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
104
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
105 redir! > test.out
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
106
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
107 for [test_case, result] in test_cases
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
108 echo test_case . ": " . result
617
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
109 call RunTest(test_case, result)
1797ca316f1c updated for version 7.0176
vimboss
parents: 615
diff changeset
110 endfor
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
111
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
112 " Valid internal command (full match)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
113 echo ':edit: 2'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
114 if exists(':edit') == 2
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
115 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
116 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
117 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
118 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
119
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
120 " Valid internal command (full match) with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
121 echo ':edit/a: 0'
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
122 if exists(':edit/a') == 0
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
123 echo "OK"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
124 else
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
125 echo "FAILED"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
126 endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
127
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
128 " Valid internal command (partial match)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
129 echo ':q: 1'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
130 if exists(':q') == 1
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
131 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
132 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
133 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
134 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
135
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
136 " Non-existing internal command
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
137 echo ':invalidcmd: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
138 if !exists(':invalidcmd')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
139 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
140 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
141 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
142 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
143
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
144 " User defined command (full match)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
145 command! MyCmd :echo 'My command'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
146 echo ':MyCmd: 2'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
147 if exists(':MyCmd') == 2
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
148 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
149 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
150 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
151 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
152
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
153 " User defined command (partial match)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
154 command! MyOtherCmd :echo 'Another command'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
155 echo ':My: 3'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
156 if exists(':My') == 3
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
157 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
158 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
159 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
160 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
161
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
162 " Command modifier
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
163 echo ':rightbelow: 2'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
164 if exists(':rightbelow') == 2
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
165 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
166 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
167 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
168 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
169
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
170 " Non-existing user defined command (full match)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
171 delcommand MyCmd
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
172
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
173 echo ':MyCmd: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
174 if !exists(':MyCmd')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
175 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
176 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
177 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
178 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
179
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
180 " Non-existing user defined command (partial match)
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
181 delcommand MyOtherCmd
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
182
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
183 echo ':My: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
184 if !exists(':My')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
185 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
186 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
187 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
188 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
189
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
190 " Valid local variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
191 let local_var = 1
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
192 echo 'local_var: 1'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
193 if exists('local_var')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
194 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
195 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
196 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
197 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
198
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
199 " Valid local variable with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
200 let local_var = 1
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
201 echo 'local_var%n: 0'
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
202 if !exists('local_var%n')
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
203 echo "OK"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
204 else
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
205 echo "FAILED"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
206 endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
207
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
208 " Non-existing local variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
209 unlet local_var
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
210 echo 'local_var: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
211 if !exists('local_var')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
212 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
213 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
214 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
215 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
216
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
217 " Non-existing autoload variable that may be autoloaded
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
218 echo 'footest#x: 0'
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
219 if !exists('footest#x')
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
220 echo "OK"
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
221 else
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
222 echo "FAILED"
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
223 endif
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
224
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
225 " Valid local list
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
226 let local_list = ["blue", "orange"]
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
227 echo 'local_list: 1'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
228 if exists('local_list')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
229 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
230 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
231 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
232 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
233
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
234 " Valid local list item
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
235 echo 'local_list[1]: 1'
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
236 if exists('local_list[1]')
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
237 echo "OK"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
238 else
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
239 echo "FAILED"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
240 endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
241
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
242 " Valid local list item with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
243 echo 'local_list[1]+5: 0'
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
244 if !exists('local_list[1]+5')
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
245 echo "OK"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
246 else
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
247 echo "FAILED"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
248 endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
249
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
250 " Invalid local list item
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
251 echo 'local_list[2]: 0'
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
252 if !exists('local_list[2]')
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
253 echo "OK"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
254 else
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
255 echo "FAILED"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
256 endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
257
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
258 " Non-existing local list
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
259 unlet local_list
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
260 echo 'local_list: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
261 if !exists('local_list')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
262 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
263 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
264 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
265 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
266
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
267 " Valid local dictionary
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
268 let local_dict = {"xcord":100, "ycord":2}
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
269 echo 'local_dict: 1'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
270 if exists('local_dict')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
271 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
272 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
273 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
274 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
275
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
276 " Non-existing local dictionary
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
277 unlet local_dict
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
278 echo 'local_dict: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
279 if !exists('local_dict')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
280 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
281 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
282 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
283 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
284
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
285 " Existing local curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
286 let str = "local"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
287 let curly_{str}_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
288 echo 'curly_' . str . '_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
289 if exists('curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
290 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
291 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
292 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
293 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
294
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
295 " Non-existing local curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
296 unlet curly_{str}_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
297 echo 'curly_' . str . '_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
298 if !exists('curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
299 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
300 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
301 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
302 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
303
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
304
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
305 " Existing global variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
306 let g:global_var = 1
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
307 echo 'g:global_var: 1'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
308 if exists('g:global_var')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
309 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
310 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
311 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
312 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
313
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
314 " Existing global variable with garbage
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
315 echo 'g:global_var-n: 1'
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
316 if !exists('g:global_var-n')
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
317 echo "OK"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
318 else
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
319 echo "FAILED"
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
320 endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 625
diff changeset
321
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
322 " Non-existing global variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
323 unlet g:global_var
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
324 echo 'g:global_var: 0'
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
325 if !exists('g:global_var')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
326 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
327 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
328 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
329 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
330
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
331 " Existing global list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
332 let g:global_list = ["blue", "orange"]
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
333 echo 'g:global_list: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
334 if exists('g:global_list')
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
335 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
336 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
337 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
338 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
339
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
340 " Non-existing global list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
341 unlet g:global_list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
342 echo 'g:global_list: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
343 if !exists('g:global_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
344 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
345 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
346 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
347 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
348
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
349 " Existing global dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
350 let g:global_dict = {"xcord":100, "ycord":2}
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
351 echo 'g:global_dict: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
352 if exists('g:global_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
353 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
354 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
355 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
356 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
357
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
358 " Non-existing global dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
359 unlet g:global_dict
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
360 echo 'g:global_dict: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
361 if !exists('g:global_dict')
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
362 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
363 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
364 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
365 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
366
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
367 " Existing global curly-brace variable
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
368 let str = "global"
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
369 let g:curly_{str}_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
370 echo 'g:curly_' . str . '_var: 1'
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
371 if exists('g:curly_{str}_var')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
372 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
373 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
374 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
375 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
376
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
377 " Non-existing global curly-brace variable
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
378 unlet g:curly_{str}_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
379 echo 'g:curly_' . str . '_var: 0'
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
380 if !exists('g:curly_{str}_var')
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
381 echo "OK"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
382 else
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
383 echo "FAILED"
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
384 endif
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
385
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
386 " Existing window variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
387 echo 'w:window_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
388 let w:window_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
389 if exists('w:window_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
390 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
391 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
392 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
393 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
394
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
395 " Non-existing window variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
396 unlet w:window_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
397 echo 'w:window_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
398 if !exists('w:window_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
399 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
400 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
401 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
402 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
403
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
404 " Existing window list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
405 let w:window_list = ["blue", "orange"]
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
406 echo 'w:window_list: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
407 if exists('w:window_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
408 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
409 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
410 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
411 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
412
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
413 " Non-existing window list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
414 unlet w:window_list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
415 echo 'w:window_list: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
416 if !exists('w:window_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
417 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
418 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
419 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
420 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
421
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
422 " Existing window dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
423 let w:window_dict = {"xcord":100, "ycord":2}
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
424 echo 'w:window_dict: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
425 if exists('w:window_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
426 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
427 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
428 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
429 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
430
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
431 " Non-existing window dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
432 unlet w:window_dict
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
433 echo 'w:window_dict: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
434 if !exists('w:window_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
435 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
436 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
437 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
438 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
439
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
440 " Existing window curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
441 let str = "window"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
442 let w:curly_{str}_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
443 echo 'w:curly_' . str . '_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
444 if exists('w:curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
445 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
446 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
447 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
448 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
449
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
450 " Non-existing window curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
451 unlet w:curly_{str}_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
452 echo 'w:curly_' . str . '_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
453 if !exists('w:curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
454 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
455 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
456 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
457 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
458
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
459 " Existing buffer variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
460 echo 'b:buffer_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
461 let b:buffer_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
462 if exists('b:buffer_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
463 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
464 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
465 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
466 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
467
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
468 " Non-existing buffer variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
469 unlet b:buffer_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
470 echo 'b:buffer_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
471 if !exists('b:buffer_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
472 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
473 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
474 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
475 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
476
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
477 " Existing buffer list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
478 let b:buffer_list = ["blue", "orange"]
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
479 echo 'b:buffer_list: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
480 if exists('b:buffer_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
481 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
482 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
483 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
484 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
485
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
486 " Non-existing buffer list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
487 unlet b:buffer_list
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
488 echo 'b:buffer_list: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
489 if !exists('b:buffer_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
490 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
491 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
492 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
493 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
494
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
495 " Existing buffer dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
496 let b:buffer_dict = {"xcord":100, "ycord":2}
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
497 echo 'b:buffer_dict: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
498 if exists('b:buffer_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
499 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
500 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
501 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
502 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
503
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
504 " Non-existing buffer dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
505 unlet b:buffer_dict
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
506 echo 'b:buffer_dict: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
507 if !exists('b:buffer_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
508 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
509 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
510 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
511 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
512
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
513 " Existing buffer curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
514 let str = "buffer"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
515 let b:curly_{str}_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
516 echo 'b:curly_' . str . '_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
517 if exists('b:curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
518 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
519 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
520 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
521 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
522
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
523 " Non-existing buffer curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
524 unlet b:curly_{str}_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
525 echo 'b:curly_' . str . '_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
526 if !exists('b:curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
527 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
528 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
529 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
530 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
531
620
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
532 " Script-local tests
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
533 source test60.vim
9e359e5759f6 updated for version 7.0177
vimboss
parents: 617
diff changeset
534
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
535 " Existing Vim internal variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
536 echo 'v:version: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
537 if exists('v:version')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
538 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
539 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
540 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
541 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
542
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
543 " Non-existing Vim internal variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
544 echo 'v:non_exists_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
545 if !exists('v:non_exists_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
546 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
547 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
548 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
549 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
550
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
551 " Function arguments
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
552 function TestFuncArg(func_arg, ...)
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
553 echo 'a:func_arg: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
554 if exists('a:func_arg')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
555 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
556 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
557 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
558 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
559
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
560 echo 'a:non_exists_arg: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
561 if !exists('a:non_exists_arg')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
562 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
563 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
564 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
565 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
566
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
567 echo 'a:1: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
568 if exists('a:1')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
569 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
570 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
571 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
572 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
573
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
574 echo 'a:2: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
575 if !exists('a:2')
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
576 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
577 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
578 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
579 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
580 endfunction
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
581
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
582 call TestFuncArg("arg1", "arg2")
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 620
diff changeset
583
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
584 echo ' g:footest#x =' g:footest#x
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
585 echo ' footest#F()' footest#F()
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
586 echo 'UndefFun()' UndefFun()
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
587
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
588 redir END
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
589 endfunction
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
590 :call TestExists()
5784
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
591 :"
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
592 :function TestHas()
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
593 redir >> test.out
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
594 for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1']
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
595 echo 'has patch ' . pl . ': ' . has('patch-' . pl)
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
596 endfor
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
597 redir END
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
598 endfunc
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
599 :call TestHas()
a44087db7238 updated for version 7.4.236
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
600 :"
1405
b63792dadc23 updated for version 7.1-120
vimboss
parents: 867
diff changeset
601 :delfunc TestExists
b63792dadc23 updated for version 7.1-120
vimboss
parents: 867
diff changeset
602 :delfunc RunTest
b63792dadc23 updated for version 7.1-120
vimboss
parents: 867
diff changeset
603 :delfunc TestFuncArg
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
604 :edit! test.out
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
605 :set ff=unix
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
606 :w
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
607 :qa!
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
608 :while getchar(1) | call getchar() | endwhile
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
609 ENDTEST
7fe13e0f5dce updated for version 7.0175
vimboss
parents:
diff changeset
610