annotate src/testdir/test_exists.vim @ 12616:4767939d10cc v8.0.1186

patch 8.0.1186: still quite a few old style tests commit https://github.com/vim/vim/commit/4a6fcf8047de13c7949ab2f27f7774acaec4ae4d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 12 21:29:22 2017 +0200 patch 8.0.1186: still quite a few old style tests Problem: Still quite a few old style tests. Solution: Convert old to new style tests. (Yegappan Lakshmanan) Avoid ringing the bell while running tests.
author Christian Brabandt <cb@256bit.org>
date Thu, 12 Oct 2017 21:30:07 +0200
parents
children 2f4be7ca1b1b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12616
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for the exists() function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 func Test_exists()
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 augroup myagroup
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 autocmd! BufEnter *.my echo "myfile edited"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 autocmd! FuncUndefined UndefFun exec "fu UndefFun()\nendfu"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 augroup END
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set rtp+=./sautest
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 " valid autocmd group
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call assert_equal(1, exists('#myagroup'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " valid autocmd group with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call assert_equal(0, exists('#myagroup+b'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " Valid autocmd group and event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(1, exists('#myagroup#BufEnter'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " Valid autocmd group, event and pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(1, exists('#myagroup#BufEnter#*.my'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " Valid autocmd event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal(1, exists('#BufEnter'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " Valid autocmd event and pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal(1, exists('#BufEnter#*.my'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " Non-existing autocmd group or event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal(0, exists('#xyzagroup'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " Non-existing autocmd group and valid autocmd event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal(0, exists('#xyzagroup#BufEnter'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " Valid autocmd group and event with no matching pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal(0, exists('#myagroup#CmdwinEnter'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " Valid autocmd group and non-existing autocmd event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal(0, exists('#myagroup#xyzacmd'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " Valid autocmd group and event and non-matching pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal(0, exists('#myagroup#BufEnter#xyzpat'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " Valid autocmd event and non-matching pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal(0, exists('#BufEnter#xyzpat'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " Empty autocmd group, event and pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal(0, exists('###'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " Empty autocmd group and event or empty event and pattern
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(0, exists('##'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 " Valid autocmd event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal(1, exists('##FileReadCmd'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " Non-existing autocmd event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal(0, exists('##MySpecialCmd'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 " Existing and working option (long form)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal(1, exists('&textwidth'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 " Existing and working option (short form)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(1, exists('&tw'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 " Existing and working option with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_equal(0, exists('&tw-'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 " Global option
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call assert_equal(1, exists('&g:errorformat'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 " Local option
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal(1, exists('&l:errorformat'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 " Negative form of existing and working option (long form)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal(0, exists('&nojoinspaces'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 " Negative form of existing and working option (short form)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call assert_equal(0, exists('&nojs'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " Non-existing option
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal(0, exists('&myxyzoption'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " Existing and working option (long form)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_equal(1, exists('+incsearch'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 " Existing and working option with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call assert_equal(0, exists('+incsearch!1'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 " Existing and working option (short form)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 call assert_equal(1, exists('+is'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 " Existing option that is hidden.
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call assert_equal(0, exists('+autoprint'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 " Existing environment variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 let $EDITOR_NAME = 'Vim Editor'
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call assert_equal(1, exists('$EDITOR_NAME'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 " Non-existing environment variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal(0, exists('$NON_ENV_VAR'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 " Valid internal function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(1, exists('*bufnr'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 " Valid internal function with ()
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(1, exists('*bufnr()'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 " Non-existing internal function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(0, exists('*myxyzfunc'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 " Valid internal function with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_equal(0, exists('*bufnr&6'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 " Valid user defined function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal(1, exists('*Test_exists'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 " Non-existing user defined function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal(0, exists('*MyxyzFunc'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " Function that may be created by FuncUndefined event
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(0, exists('*UndefFun'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 " Function that may be created by script autoloading
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call assert_equal(0, exists('*footest#F'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 " Valid internal command (full match)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_equal(2, exists(':edit'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " Valid internal command (full match) with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 call assert_equal(0, exists(':edit/a'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 " Valid internal command (partial match)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 call assert_equal(1, exists(':q'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 " Non-existing internal command
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 call assert_equal(0, exists(':invalidcmd'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 " User defined command (full match)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 command! MyCmd :echo 'My command'
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(2, exists(':MyCmd'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 " User defined command (partial match)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 command! MyOtherCmd :echo 'Another command'
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 call assert_equal(3, exists(':My'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 " Command modifier
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call assert_equal(2, exists(':rightbelow'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 " Non-existing user defined command (full match)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 delcommand MyCmd
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call assert_equal(0, exists(':MyCmd'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 " Non-existing user defined command (partial match)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 delcommand MyOtherCmd
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(0, exists(':My'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 " Valid local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 let local_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 call assert_equal(1, exists('local_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 " Valid local variable with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal(0, exists('local_var%n'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 " Non-existing local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 unlet local_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call assert_equal(0, exists('local_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 " Non-existing autoload variable that may be autoloaded
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(0, exists('footest#x'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 " Valid local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 let local_list = ["blue", "orange"]
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call assert_equal(1, exists('local_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 " Valid local list item
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 call assert_equal(1, exists('local_list[1]'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 " Valid local list item with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 call assert_equal(0, exists('local_list[1]+5'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 " Invalid local list item
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call assert_equal(0, exists('local_list[2]'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 " Non-existing local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 unlet local_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 call assert_equal(0, exists('local_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 " Valid local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let local_dict = {"xcord":100, "ycord":2}
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 call assert_equal(1, exists('local_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 " Non-existing local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 unlet local_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 call assert_equal(0, exists('local_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 " Existing local curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 let str = "local"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 let curly_{str}_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_equal(1, exists('curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 " Non-existing local curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 unlet curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 call assert_equal(0, exists('curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 " Existing global variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 let g:global_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call assert_equal(1, exists('g:global_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 " Existing global variable with garbage
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_equal(0, exists('g:global_var-n'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 " Non-existing global variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 unlet g:global_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call assert_equal(0, exists('g:global_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 " Existing global list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 let g:global_list = ["blue", "orange"]
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 call assert_equal(1, exists('g:global_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 " Non-existing global list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 unlet g:global_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 call assert_equal(0, exists('g:global_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 " Existing global dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 let g:global_dict = {"xcord":100, "ycord":2}
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 call assert_equal(1, exists('g:global_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 " Non-existing global dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 unlet g:global_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(0, exists('g:global_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 " Existing global curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 let str = "global"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 let g:curly_{str}_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 call assert_equal(1, exists('g:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 " Non-existing global curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 unlet g:curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 call assert_equal(0, exists('g:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 " Existing window variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 let w:window_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 call assert_equal(1, exists('w:window_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 " Non-existing window variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 unlet w:window_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 call assert_equal(0, exists('w:window_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 " Existing window list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 let w:window_list = ["blue", "orange"]
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 call assert_equal(1, exists('w:window_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 " Non-existing window list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 unlet w:window_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 call assert_equal(0, exists('w:window_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 " Existing window dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 let w:window_dict = {"xcord":100, "ycord":2}
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 call assert_equal(1, exists('w:window_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 " Non-existing window dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 unlet w:window_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 call assert_equal(0, exists('w:window_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 " Existing window curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 let str = "window"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 let w:curly_{str}_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 call assert_equal(1, exists('w:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 " Non-existing window curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 unlet w:curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 call assert_equal(0, exists('w:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 " Existing tab variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 let t:tab_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 call assert_equal(1, exists('t:tab_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 " Non-existing tab variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 unlet t:tab_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 call assert_equal(0, exists('t:tab_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 " Existing tab list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 let t:tab_list = ["blue", "orange"]
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 call assert_equal(1, exists('t:tab_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 " Non-existing tab list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 unlet t:tab_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call assert_equal(0, exists('t:tab_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 " Existing tab dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 let t:tab_dict = {"xcord":100, "ycord":2}
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 call assert_equal(1, exists('t:tab_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 " Non-existing tab dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 unlet t:tab_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 call assert_equal(0, exists('t:tab_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 " Existing tab curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 let str = "tab"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 let t:curly_{str}_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 call assert_equal(1, exists('t:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 " Non-existing tab curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 unlet t:curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 call assert_equal(0, exists('t:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 " Existing buffer variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 let b:buffer_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 call assert_equal(1, exists('b:buffer_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 " Non-existing buffer variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 unlet b:buffer_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call assert_equal(0, exists('b:buffer_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 " Existing buffer list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 let b:buffer_list = ["blue", "orange"]
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 call assert_equal(1, exists('b:buffer_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 " Non-existing buffer list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 unlet b:buffer_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 call assert_equal(0, exists('b:buffer_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 " Existing buffer dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 let b:buffer_dict = {"xcord":100, "ycord":2}
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 call assert_equal(1, exists('b:buffer_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 " Non-existing buffer dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 unlet b:buffer_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 call assert_equal(0, exists('b:buffer_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 " Existing buffer curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 let str = "buffer"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 let b:curly_{str}_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 call assert_equal(1, exists('b:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 " Non-existing buffer curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 unlet b:curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 call assert_equal(0, exists('b:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 " Existing Vim internal variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 call assert_equal(1, exists('v:version'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 " Non-existing Vim internal variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 call assert_equal(0, exists('v:non_exists_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 " Existing script-local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 let s:script_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 call assert_equal(1, exists('s:script_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 " Non-existing script-local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 unlet s:script_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 call assert_equal(0, exists('s:script_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 " Existing script-local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 let s:script_list = ["blue", "orange"]
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 call assert_equal(1, exists('s:script_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 " Non-existing script-local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 unlet s:script_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 call assert_equal(0, exists('s:script_list'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 " Existing script-local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 let s:script_dict = {"xcord":100, "ycord":2}
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 call assert_equal(1, exists('s:script_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 " Non-existing script-local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 unlet s:script_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 call assert_equal(0, exists('s:script_dict'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 " Existing script curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 let str = "script"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 let s:curly_{str}_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 call assert_equal(1, exists('s:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 " Non-existing script-local curly-brace variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 unlet s:curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 call assert_equal(0, exists('s:curly_{str}_var'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 " Existing script-local function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 function! s:my_script_func()
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 endfunction
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 echo '*s:my_script_func: 1'
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 call assert_equal(1, exists('*s:my_script_func'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300 " Non-existing script-local function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 delfunction s:my_script_func
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 call assert_equal(0, exists('*s:my_script_func'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 unlet str
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 call assert_equal(1, g:footest#x)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 call assert_equal(0, footest#F())
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 call assert_equal(0, UndefFun())
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 endfunc
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 " exists() test for Function arguments
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 func FuncArg_Tests(func_arg, ...)
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 call assert_equal(1, exists('a:func_arg'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 call assert_equal(0, exists('a:non_exists_arg'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 call assert_equal(1, exists('a:1'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 call assert_equal(0, exists('a:2'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317 endfunc
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319 func Test_exists_funcarg()
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320 call FuncArg_Tests("arg1", "arg2")
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 endfunc