annotate src/testdir/test60.vim @ 11352:251f1833db7d v8.0.0561

patch 8.0.0561: undefined behavior when using backslash after empty line commit https://github.com/vim/vim/commit/478af67dd6a9adc456464c3736bda328ae3a28cb Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 10 22:22:42 2017 +0200 patch 8.0.0561: undefined behavior when using backslash after empty line Problem: Undefined behavior when using backslash after empty line. Solution: Check for an empty line. (Dominique Pelle, closes https://github.com/vim/vim/issues/1631)
author Christian Brabandt <cb@256bit.org>
date Mon, 10 Apr 2017 22:30:03 +0200
parents b63792dadc23
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
1 " Vim script for exists() function test
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
2 " Script-local variables are checked here
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
3
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
4 " Existing script-local variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
5 let s:script_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
6 echo 's:script_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
7 if exists('s:script_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
8 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
9 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
10 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
11 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
12
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
13 " Non-existing script-local variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
14 unlet s:script_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
15 echo 's:script_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
16 if !exists('s:script_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
17 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
18 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
19 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
20 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
21
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
22 " Existing script-local list
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
23 let s:script_list = ["blue", "orange"]
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
24 echo 's:script_list: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
25 if exists('s:script_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
26 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
27 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
28 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
29 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
30
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
31 " Non-existing script-local list
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
32 unlet s:script_list
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
33 echo 's:script_list: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
34 if !exists('s:script_list')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
35 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
36 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
37 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
38 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
39
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
40 " Existing script-local dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
41 let s:script_dict = {"xcord":100, "ycord":2}
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
42 echo 's:script_dict: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
43 if exists('s:script_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
44 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
45 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
46 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
47 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
48
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
49 " Non-existing script-local dictionary
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
50 unlet s:script_dict
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
51 echo 's:script_dict: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
52 if !exists('s:script_dict')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
53 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
54 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
55 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
56 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
57
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
58 " Existing script curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
59 let str = "script"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
60 let s:curly_{str}_var = 1
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
61 echo 's:curly_' . str . '_var: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
62 if exists('s:curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
63 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
64 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
65 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
66 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
67
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
68 " Non-existing script-local curly-brace variable
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
69 unlet s:curly_{str}_var
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
70 echo 's:curly_' . str . '_var: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
71 if !exists('s:curly_{str}_var')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
72 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
73 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
74 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
75 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
76
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
77 " Existing script-local function
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
78 function! s:my_script_func()
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
79 endfunction
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
80
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
81 echo '*s:my_script_func: 1'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
82 if exists('*s:my_script_func')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
83 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
84 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
85 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
86 endif
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
87
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
88 " Non-existing script-local function
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
89 delfunction s:my_script_func
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
90
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
91 echo '*s:my_script_func: 0'
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
92 if !exists('*s:my_script_func')
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
93 echo "OK"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
94 else
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
95 echo "FAILED"
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
96 endif
1405
b63792dadc23 updated for version 7.1-120
vimboss
parents: 625
diff changeset
97 unlet str
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents:
diff changeset
98