annotate src/testdir/test_exists.vim @ 19783:546bdeef35f1 v8.2.0448

patch 8.2.0448: various functions not properly tested Commit: https://github.com/vim/vim/commit/0e05de46226eb4e5ea580beefa71831f92d613d3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 25 22:23:46 2020 +0100 patch 8.2.0448: various functions not properly tested Problem: Various functions not properly tested. Solution: Add more tests, especially for failures. (Yegappan Lakshmanan, closes #5843)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Mar 2020 22:30:04 +0100
parents 2f4be7ca1b1b
children 2dc5e6ddeb4c
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'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
71 if has('unix')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
72 " ${name} environment variables are supported only on Unix-like systems
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
73 call assert_equal(1, exists('${VIM}'))
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
74 endif
12616
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 " Non-existing environment variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 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
77
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 " Valid 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(1, exists('*bufnr'))
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 ()
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 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
82 " Non-existing internal 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(0, exists('*myxyzfunc'))
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 " 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
85 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
86 " Valid user defined function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 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
88 " 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
89 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
90 " 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
91 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
92 " 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
93 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
94
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 " 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
96 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
97 " 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
98 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
99 " 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
100 call assert_equal(1, exists(':q'))
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12616
diff changeset
101 " Valid internal command with a digit
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12616
diff changeset
102 call assert_equal(2, exists(':2match'))
12616
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 " Non-existing internal command
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 call assert_equal(0, exists(':invalidcmd'))
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12616
diff changeset
105 " Internal command with a count
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 12616
diff changeset
106 call assert_equal(0, exists(':3buffer'))
12616
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 " 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
109 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
110 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
111 " 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
112 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
113 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
114
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 " Command modifier
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 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
117
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 " 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
119 delcommand MyCmd
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 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
121
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 " 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
123 delcommand MyOtherCmd
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 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
125
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 " Valid local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 let local_var = 1
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 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
129 " 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
130 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
131 " Non-existing local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 unlet local_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 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
134
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 " 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
136 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
137
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 " Valid local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 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
140 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
141 " Valid local list item
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 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
143 " 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
144 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
145 " Invalid local list item
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 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
147 " Non-existing local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 unlet local_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 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
150 " Valid local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 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
152 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
153 " Non-existing local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 unlet local_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 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
156 " 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
157 let str = "local"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 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
159 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
160 " 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
161 unlet curly_{str}_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 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
163
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 " Existing global variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 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
166 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
167 " 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
168 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
169 " Non-existing global variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 unlet g:global_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 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
172 " Existing global list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 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
174 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
175 " Non-existing global list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 unlet g:global_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 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
178 " Existing global dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 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
180 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
181 " Non-existing global dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 unlet g:global_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 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
184 " 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
185 let str = "global"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 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
187 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
188 " 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
189 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
190 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
191
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 " Existing window variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 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
194 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
195 " Non-existing window variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 unlet w:window_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 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
198 " Existing window list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 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
200 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
201 " Non-existing window list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 unlet w:window_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 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
204 " Existing window dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 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
206 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
207 " Non-existing window dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 unlet w:window_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 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
210 " 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
211 let str = "window"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 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
213 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
214 " 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
215 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
216 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
217
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 " Existing tab variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 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
220 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
221 " Non-existing tab variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 unlet t:tab_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 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
224 " Existing tab list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 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
226 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
227 " Non-existing tab list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 unlet t:tab_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 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
230 " Existing tab dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 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
232 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
233 " Non-existing tab dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 unlet t:tab_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 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
236 " 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
237 let str = "tab"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 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
239 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
240 " 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
241 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
242 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
243
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 " Existing buffer variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 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
246 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
247 " Non-existing buffer variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 unlet b:buffer_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 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
250 " Existing buffer list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 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
252 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
253 " Non-existing buffer list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 unlet b:buffer_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 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
256 " Existing buffer dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 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
258 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
259 " Non-existing buffer dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 unlet b:buffer_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 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
262 " 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
263 let str = "buffer"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 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
265 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
266 " 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
267 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
268 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
269
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 " Existing Vim internal variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 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
272 " 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
273 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
274
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 " Existing script-local variable
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 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
277 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
278 " 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
279 unlet s:script_var
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 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
281 " Existing script-local list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 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
283 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
284 " 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
285 unlet s:script_list
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 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
287 " Existing script-local dictionary
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 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
289 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
290 " 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
291 unlet s:script_dict
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 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
293 " 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
294 let str = "script"
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 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
296 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
297 " 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
298 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
299 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
300
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 " Existing script-local function
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 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
303 endfunction
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 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
306 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
307
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 " 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
309 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
310
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 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
312 unlet str
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 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
315 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
316 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
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 " 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
320 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
321 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
322 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
323 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
324 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
325 endfunc
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 func Test_exists_funcarg()
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 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
329 endfunc
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
330
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
331 " vim: shiftwidth=2 sts=2 expandtab