annotate src/testdir/test49.vim @ 1031:1780e6046802 v7.0.157

updated for version 7.0-157
author vimboss
date Wed, 01 Nov 2006 17:34:40 +0000
parents eac1cd7f1eff
children 88095f75d63b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim script language tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 697
diff changeset
3 " Last Change: 2006 Apr 28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Test environment {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " Adding new tests easily. {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " Writing new tests is eased considerably with the following functions and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " abbreviations (see "Commands for recording the execution path", "Automatic
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " argument generation").
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " To get the abbreviations, execute the command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " :let test49_set_env = 1 | source test49.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " To get them always (from src/testdir), put a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " au! BufRead test49.vim let test49_set_env = 1 | source test49.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " into the local .vimrc file in the src/testdir directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 if exists("test49_set_env") && test49_set_env
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " Automatic argument generation for the test environment commands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 function! Xsum()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 let addend = substitute(getline("."), '^.*"\s*X:\s*\|^.*', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " Evaluate arithmetic expression.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 if addend != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 exec "let g:Xsum = g:Xsum + " . addend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 function! Xcheck()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 let g:Xsum=0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 ?XpathINIT?,.call Xsum()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 exec "norm A "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 return g:Xsum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 iab Xcheck Xcheck<Space><C-R>=Xcheck()<CR><C-O>x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 function! Xcomment(num)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 let str = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 let tabwidth = &sts ? &sts : &ts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 let tabs = (48+tabwidth - a:num - virtcol(".")) / tabwidth
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 while tabs > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 let str = str . "\t"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 let tabs = tabs - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 let str = str . '" X:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 return str
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 function! Xloop()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 let back = line(".") . "|norm" . virtcol(".") . "|"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 norm 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 let last = search('X\(loop\|path\)INIT\|Xloop\>', "bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 exec back
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 let theline = getline(last)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 if theline =~ 'X\(loop\|path\)INIT'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 let num = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 let num = 2 * substitute(theline, '.*Xloop\s*\(\d\+\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 ?X\(loop\|path\)INIT?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 \s/\(XloopINIT!\=\s*\d\+\s\+\)\@<=\(\d\+\)/\=2*submatch(2)/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 exec back
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 exec "norm a "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 return num . Xcomment(strlen(num))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 iab Xloop Xloop<Space><C-R>=Xloop()<CR><C-O>x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 function! Xpath(loopinit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 let back = line(".") . "|norm" . virtcol(".") . "|"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 norm 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 let last = search('XpathINIT\|Xpath\>\|XloopINIT', "bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 exec back
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let theline = getline(last)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 if theline =~ 'XpathINIT'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 let num = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 elseif theline =~ 'Xpath\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let num = 2 * substitute(theline, '.*Xpath\s*\(\d\+\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 let pattern = '.*XloopINIT!\=\s*\(\d\+\)\s*\(\d\+\).*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 let num = substitute(theline, pattern, '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 let factor = substitute(theline, pattern, '\2', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 " The "<C-O>x" from the "Xpath" iab and the character triggering its
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " expansion are in the input buffer. Save and clear typeahead so
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 " that it is not read away by the call to "input()" below. Restore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 " afterwards.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 call inputsave()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 let loops = input("Number of iterations in previous loop? ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 call inputrestore()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 while (loops > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 let num = num * factor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 exec "norm a "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 if a:loopinit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 return num . " 1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 return num . Xcomment(strlen(num))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 iab Xpath Xpath<Space><C-R>=Xpath(0)<CR><C-O>x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 iab XloopINIT XloopINIT<Space><C-R>=Xpath(1)<CR><C-O>x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " Also useful (see ExtraVim below):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 aug ExtraVim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 au!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 au BufEnter <sfile> syn region ExtraVim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 \ start=+^if\s\+ExtraVim(.*)+ end=+^endif+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 \ transparent keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 au BufEnter <sfile> syn match ExtraComment /^"/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 \ contained containedin=ExtraVim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 au BufEnter <sfile> hi link ExtraComment vimComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 aug Xpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 au BufEnter <sfile> syn keyword Xpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 \ XpathINIT Xpath XloopINIT Xloop XloopNEXT Xcheck Xout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 au BufEnter <sfile> hi link Xpath Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 do BufEnter <sfile>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 " Do not execute the tests when sourcing this file for getting the functions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 " and abbreviations above, which are intended for easily adding new test
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 " cases; they are not needed for test execution. Unlet the variable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 " controlling this so that an explicit ":source" command for this file will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 " execute the tests.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 unlet test49_set_env
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 " Commands for recording the execution path. {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 " The Xpath/Xloop commands can be used for computing the eXecution path by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 " adding (different) powers of 2 from those script lines, for which the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 " execution should be checked. Xloop provides different addends for each
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
150 " execution of a loop. Permitted values are 2^0 to 2^30, so that 31 execution
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 " points (multiply counted inside loops) can be tested.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 " Note that the arguments of the following commands can be generated
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 " automatically, see below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 " Usage: {{{3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 " - Use XpathINIT at the beginning of the test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 " - Use Xpath to check if a line is executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 " Argument: power of 2 (decimal).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 " - To check multiple execution of loops use Xloop for automatically
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 " computing Xpath values:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 " - Use XloopINIT before the loop.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 " Two arguments:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 " - the first Xpath value (power of 2) to be used (Xnext),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 " - factor for computing a new Xnext value when reexecuting a loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 " (by a ":continue" or ":endwhile"); this should be 2^n where
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 " n is the number of Xloop commands inside the loop.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 " If XloopINIT! is used, the first execution of XloopNEXT is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 " a no-operation.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 " - Use Xloop inside the loop:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 " One argument:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 " The argument and the Xnext value are multiplied to build the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 " next Xpath value. No new Xnext value is prepared. The argument
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 " should be 2^(n-1) for the nth Xloop command inside the loop.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 " If the loop has only one Xloop command, the argument can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 " ommitted (default: 1).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 " - Use XloopNEXT before ":continue" and ":endwhile". This computes a new
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 " Xnext value for the next execution of the loop by multiplying the old
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 " one with the factor specified in the XloopINIT command. No Argument.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 " Alternatively, when XloopINIT! is used, a single XloopNEXT at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 " beginning of the loop can be used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 " Nested loops are not supported.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 " - Use Xcheck at end of each test. It prints the test number, the expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 " execution path value, the test result ("OK" or "FAIL"), and, if the tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 " fails, the actual execution path.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 " One argument:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 " Expected Xpath/Xloop sum for the correct execution path.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 " In order that this value can be computed automatically, do the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 " following: For each line in the test with an Xpath and Xloop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 " command, add a comment starting with "X:" and specifying an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 " expression that evaluates to the value contributed by this line to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 " the correct execution path. (For copying an Xpath argument of at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 " least two digits into the comment, press <C-P>.) At the end of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 " test, just type "Xcheck" and press <Esc>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 " - In order to add additional information to the test output file, use the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 " Xout command. Argument(s) like ":echo".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 " Automatic argument generation: {{{3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 " The arguments of the Xpath, XloopINIT, Xloop, and Xcheck commands can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 " generated automatically, so that new tests can easily be written without
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 " mental arithmetic. The Xcheck argument is computed from the "X:" comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 " of the preceding Xpath and Xloop commands. See the commands and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 " abbreviations at the beginning of this file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 " Implementation: {{{3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 " XpathINIT, Xpath, XloopINIT, Xloop, XloopNEXT, Xcheck, Xout.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 " The variants for existing g:ExtraVimResult are needed when executing a script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 " in an extra Vim process, see ExtraVim below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 " EXTRA_VIM_START - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 com! XpathINIT let g:Xpath = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 if exists("g:ExtraVimResult")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 com! -count -bar Xpath exec "!echo <count> >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 com! -count -bar Xpath let g:Xpath = g:Xpath + <count>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 com! -count -nargs=1 -bang
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 \ XloopINIT let g:Xnext = <count> |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 \ let g:Xfactor = <args> |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 \ let g:Xskip = strlen("<bang>")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 if exists("g:ExtraVimResult")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 com! -count=1 -bar Xloop exec "!echo " . (g:Xnext * <count>) . " >>" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 \ g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 com! -count=1 -bar Xloop let g:Xpath = g:Xpath + g:Xnext * <count>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 com! XloopNEXT let g:Xnext = g:Xnext *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 \ (g:Xskip ? 1 : g:Xfactor) |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 \ let g:Xskip = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 let @r = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 let Xtest = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 com! -count Xcheck let Xresult = "*** Test " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 \ (Xtest<10?" ":Xtest<100?" ":"") .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 \ Xtest . ": " . (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 \ (Xpath==<count>) ? "OK (".Xpath.")" :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 \ "FAIL (".Xpath." instead of <count>)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 \ ) |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 \ let @R = Xresult . "\n" |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 \ echo Xresult |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 \ let Xtest = Xtest + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 if exists("g:ExtraVimResult")
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
260 com! -nargs=+ Xoutq exec "!echo @R:'" .
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
261 \ substitute(substitute(<q-args>,
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
262 \ "'", '&\\&&', "g"), "\n", "@NL@", "g")
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
263 \ . "' >>" . g:ExtraVimResult
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 else
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
265 com! -nargs=+ Xoutq let @R = "--- Test " .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 \ (g:Xtest<10?" ":g:Xtest<100?" ":"") .
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
267 \ g:Xtest . ": " . substitute(<q-args>,
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
268 \ "\n", "&\t ", "g") . "\n"
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
269 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
270 com! -nargs=+ Xout exec 'Xoutq' <args>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 " Switch off storing of lines for undoing changes. Speeds things up a little.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 set undolevels=-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 " EXTRA_VIM_STOP - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 " ExtraVim() - Run a script file in an extra Vim process. {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 " This is useful for testing immediate abortion of the script processing due to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 " an error in a command dynamically enclosed by a :try/:tryend region or when an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 " exception is thrown but not caught or when an interrupt occurs. It can also
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 " be used for testing :finish.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 " An interrupt location can be specified by an "INTERRUPT" comment. A number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 " telling how often this location is reached (in a loop or in several function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 " calls) should be specified as argument. When missing, once per script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 " invocation or function call is assumed. INTERRUPT locations are tested by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 " setting a breakpoint in that line and using the ">quit" debug command when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 " the breakpoint is reached. A function for which an INTERRUPT location is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 " specified must be defined before calling it (or executing it as a script by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 " using ExecAsScript below).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 " This function is only called in normal modus ("g:ExtraVimResult" undefined).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 " Tests to be executed as an extra script should be written as follows:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 " column 1 column 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 " | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 " v v
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 " XpathINIT XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 " if ExtraVim() if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 " ... " ...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 " ... " ...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 " endif endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 " Xcheck <number> Xcheck <number>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 " Double quotes in column 1 are removed before the script is executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 " They should be used if the test has unbalanced conditionals (:if/:endif,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 " :while:/endwhile, :try/:endtry) or for a line with a syntax error. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 " extra script may use Xpath, XloopINIT, Xloop, XloopNEXT, and Xout as usual.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 " A file name may be specified as argument. All messages of the extra Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 " process are then redirected to the file. An existing file is overwritten.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 let ExtraVimCount = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 let ExtraVimBase = expand("<sfile>")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 let ExtraVimTestEnv = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 function! ExtraVim(...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 " Count how often this function is called.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 let g:ExtraVimCount = g:ExtraVimCount + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 " Disable folds to prevent that the ranges in the ":write" commands below
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 " are extended up to the end of a closed fold. This also speeds things up
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 " considerably.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 set nofoldenable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 " Open a buffer for this test script and copy the test environment to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 " a temporary file. Take account of parts relevant for the extra script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 " execution only.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 let current_buffnr = bufnr("%")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 execute "view +1" g:ExtraVimBase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 if g:ExtraVimCount == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 let g:ExtraVimTestEnv = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 execute "/E" . "XTRA_VIM_START/+,/E" . "XTRA_VIM_STOP/-w"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 \ g:ExtraVimTestEnv "|']+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 execute "/E" . "XTRA_VIM_START/+,/E" . "XTRA_VIM_STOP/-w >>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 \ g:ExtraVimTestEnv "|']+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 execute "/E" . "XTRA_VIM_START/+,/E" . "XTRA_VIM_STOP/-w >>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 \ g:ExtraVimTestEnv "|']+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 execute "/E" . "XTRA_VIM_START/+,/E" . "XTRA_VIM_STOP/-w >>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 \ g:ExtraVimTestEnv "|']+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 " Start the extra Vim script with a ":source" command for the test
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 " environment. The source line number where the extra script will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 " appended, needs to be passed as variable "ExtraVimBegin" to the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 let extra_script = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 exec "!echo 'source " . g:ExtraVimTestEnv . "' >" . extra_script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 let extra_begin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 " Starting behind the test environment, skip over the first g:ExtraVimCount
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 " occurrences of "if ExtraVim()" and copy the following lines up to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 " matching "endif" to the extra Vim script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 execute "/E" . "ND_OF_TEST_ENVIRONMENT/"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 exec 'norm ' . g:ExtraVimCount . '/^\s*if\s\+ExtraVim(.*)/+' . "\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 execute ".,/^endif/-write >>" . extra_script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 " Open a buffer for the extra Vim script, delete all ^", and write the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 " script if was actually modified.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 execute "edit +" . (extra_begin + 1) extra_script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 ,$s/^"//e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 update
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 " Count the INTERRUPTs and build the breakpoint and quit commands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 let breakpoints = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 let debug_quits = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 let in_func = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 exec extra_begin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 while search(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 \ '"\s*INTERRUPT\h\@!\|^\s*fu\%[nction]\>!\=\s*\%(\u\|s:\)\w*\s*(\|'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 \ . '^\s*\\\|^\s*endf\%[unction]\>\|'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 \ . '\%(^\s*fu\%[nction]!\=\s*\)\@<!\%(\u\|s:\)\w*\s*(\|'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 \ . 'ExecAsScript\s\+\%(\u\|s:\)\w*',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 \ "W") > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 let theline = getline(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 if theline =~ '^\s*fu'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 " Function definition.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 let in_func = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 let func_start = line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 let func_name = substitute(theline,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 \ '^\s*fu\%[nction]!\=\s*\(\%(\u\|s:\)\w*\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 elseif theline =~ '^\s*endf'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 " End of function definition.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 let in_func = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 let finding = substitute(theline, '.*\(\%' . col(".") . 'c.*\)',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 \ '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 if finding =~ '^"\s*INTERRUPT\h\@!'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 " Interrupt comment. Compose as many quit commands as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 " specified.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 let cnt = substitute(finding,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 \ '^"\s*INTERRUPT\s*\(\d*\).*$', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 let quits = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 while cnt > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 " Use "\r" rather than "\n" to separate the quit commands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 " "\r" is not interpreted as command separator by the ":!"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 " command below but works to separate commands in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 " external vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 let quits = quits . "q\r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 let cnt = cnt - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 if in_func
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 " Add the function breakpoint and note the number of quits
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 " to be used, if specified, or one for every call else.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 let breakpoints = breakpoints . " -c 'breakadd func " .
697
f08390485cd3 updated for version 7.0210
vimboss
parents: 341
diff changeset
409 \ (line(".") - func_start) . " " .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 \ func_name . "'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 if quits != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 let debug_quits = debug_quits . quits
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 elseif !exists("quits{func_name}")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 let quits{func_name} = "q\r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 let quits{func_name} = quits{func_name} . "q\r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 " Add the file breakpoint and the quits to be used for it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 let breakpoints = breakpoints . " -c 'breakadd file " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 \ line(".") . " " . extra_script . "'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 if quits == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 let quits = "q\r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 let debug_quits = debug_quits . quits
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 " Add the quits to be used for calling the function or executing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 " it as script file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 if finding =~ '^ExecAsScript'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 " Sourcing function as script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 let finding = substitute(finding,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 \ '^ExecAsScript\s\+\(\%(\u\|s:\)\w*\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 " Function call.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 let finding = substitute(finding,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 \ '^\(\%(\u\|s:\)\w*\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 if exists("quits{finding}")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 let debug_quits = debug_quits . quits{finding}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 " Close the buffer for the script and create an (empty) resultfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 bwipeout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 let resultfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 exec "!>" . resultfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 " Run the script in an extra vim. Switch to extra modus by passing the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 " resultfile in ExtraVimResult. Redirect messages to the file specified as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 " argument if any. Use ":debuggreedy" so that the commands provided on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 " pipe are consumed at the debug prompt. Use "-N" to enable command-line
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
455 " continuation ("C" in 'cpo'). Add "nviminfo" to 'viminfo' to avoid
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 " messing up the user's viminfo file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 let redirect = a:0 ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 \ " -c 'au VimLeave * redir END' -c 'redir\\! >" . a:1 . "'" : ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 exec "!echo '" . debug_quits . "q' | ../vim -u NONE -N -Xes" . redirect .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 \ " -c 'debuggreedy|set viminfo+=nviminfo'" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 \ " -c 'let ExtraVimBegin = " . extra_begin . "'" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 \ " -c 'let ExtraVimResult = \"" . resultfile . "\"'" . breakpoints .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 \ " -S " . extra_script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 " Build the resulting sum for resultfile and add it to g:Xpath. Add Xout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 " information provided by the extra Vim process to the test output.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 let sum = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 exec "edit" resultfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 let line = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 while line <= line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 let theline = getline(line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 if theline =~ '^@R:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 exec 'Xout "' . substitute(substitute(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 \ escape(escape(theline, '"'), '\"'),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 \ '^@R:', '', ""), '@NL@', "\n", "g") . '"'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 let sum = sum + getline(line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 let line = line + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 bwipeout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 let g:Xpath = g:Xpath + sum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 " Delete the extra script and the resultfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 call delete(extra_script)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 call delete(resultfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 " Switch back to the buffer that was active when this function was entered.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 exec "buffer" current_buffnr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 " Return 0. This protects extra scripts from being run in the main Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 " process.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 " ExtraVimThrowpoint() - Relative throwpoint in ExtraVim script {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 "
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
499 " Evaluates v:throwpoint and returns the throwpoint relative to the beginning of
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 " an ExtraVim script as passed by ExtraVim() in ExtraVimBegin.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 " EXTRA_VIM_START - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 function! ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 if !exists("g:ExtraVimBegin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 Xout "ExtraVimThrowpoint() used outside ExtraVim() script."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 return v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 if v:throwpoint =~ '^function\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 return v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 return "line " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 \ (substitute(v:throwpoint, '.*, line ', '', "") - g:ExtraVimBegin) .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 \ " of ExtraVim() script"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 " EXTRA_VIM_STOP - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 " MakeScript() - Make a script file from a function. {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 " Create a script that consists of the body of the function a:funcname.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 " Replace any ":return" by a ":finish", any argument variable by a global
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 " variable, and and every ":call" by a ":source" for the next following argument
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 " in the variable argument list. This function is useful if similar tests are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 " to be made for a ":return" from a function call or a ":finish" in a script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 " file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 " In order to execute a function specifying an INTERRUPT location (see ExtraVim)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 " as a script file, use ExecAsScript below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 " EXTRA_VIM_START - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 function! MakeScript(funcname, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 let script = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 execute "redir! >" . script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 execute "function" a:funcname
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 redir END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 execute "edit" script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 " Delete the "function" and the "endfunction" lines. Do not include the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 " word "function" in the pattern since it might be translated if LANG is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 " set. When MakeScript() is being debugged, this deletes also the debugging
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 " output of its line 3 and 4.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 exec '1,/.*' . a:funcname . '(.*)/d'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 /^\d*\s*endfunction\>/,$d
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 %s/^\d*//e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 %s/return/finish/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 %s/\<a:\(\h\w*\)/g:\1/ge
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 normal gg0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 let cnt = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 while search('\<call\s*\%(\u\|s:\)\w*\s*(.*)', 'W') > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 let cnt = cnt + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 s/\<call\s*\%(\u\|s:\)\w*\s*(.*)/\='source ' . a:{cnt}/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 g/^\s*$/d
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 write
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 bwipeout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 return script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 " EXTRA_VIM_STOP - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 " ExecAsScript - Source a temporary script made from a function. {{{2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 " Make a temporary script file from the function a:funcname, ":source" it, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 " delete it afterwards.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 " When inside ":if ExtraVim()", add a file breakpoint for each INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 " location specified in the function.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 " EXTRA_VIM_START - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 function! ExecAsScript(funcname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 " Make a script from the function passed as argument.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 let script = MakeScript(a:funcname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 " When running in an extra Vim process, add a file breakpoint for each
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 " function breakpoint set when the extra Vim process was invoked by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 " ExtraVim().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 if exists("g:ExtraVimResult")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 let bplist = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 execute "redir! >" . bplist
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 breaklist
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 redir END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 execute "edit" bplist
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 " Get the line number from the function breakpoint. Works also when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 " LANG is set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 execute 'v/^\s*\d\+\s\+func\s\+' . a:funcname . '\s.*/d'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 %s/^\s*\d\+\s\+func\s\+\%(\u\|s:\)\w*\s\D*\(\d*\).*/\1/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 let cnt = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 while cnt < line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 let cnt = cnt + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 if getline(cnt) != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 execute "breakadd file" getline(cnt) script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 call delete(bplist)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 " Source and delete the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 exec "source" script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 call delete(script)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 " EXTRA_VIM_STOP - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 " END_OF_TEST_ENVIRONMENT - do not change or remove this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 " Test 1: :endwhile in function {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 " Detect if a broken loop is (incorrectly) reactivated by the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 " :endwhile. Use a :return to prevent an endless loop, and make
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 " this test first to get a meaningful result on an error before other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 " tests will hang.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 let first = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 XloopINIT 2 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 Xloop 1 " X: 2 + 0 * 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 if first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 Xloop 2 " X: 4 + 0 * 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 let first = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 Xloop 4 " X: 0 + 0 * 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 Xpath 256 " X: 256 + 0 * 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 let first = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 XloopINIT 512 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 Xloop 1 " X: 512 + 0 * 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 if first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 Xloop 2 " X: 1024 + 0 * 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 let first = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 Xloop 4 " X: 0 + 0 * 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 if 1 " unmatched :if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 Xcheck 34695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 " Leave F and G for execution as scripts in the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 " Test 2: :endwhile in script {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 " Detect if a broken loop is (incorrectly) reactivated by the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 " :endwhile. Use a :finish to prevent an endless loop, and place
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 " this test before others that might hang to get a meaningful result
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 " on an error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 " This test executes the bodies of the functions F and G from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 " previous test as script files (:return replaced by :finish).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 ExecAsScript F " X: 1 + 2 + 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 ExecAsScript G " X: 256 + 512 + 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 unlet first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 Xcheck 34695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 " Test 3: :if, :elseif, :while, :continue, :break {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 XloopINIT 2 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 while loops > -1 " main loop: loops == 3, 2, 1 (which breaks)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 if loops <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 let break_err = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 let loops = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 else " 3: 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 Xloop 1 " X: 2 + 2*512 + 2*512*512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 if (loops == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 while loops == 2 " dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 Xloop 2 " X: 4*512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 continue " stop dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 continue " continue main loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 elseif (loops == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 while p " dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 Xloop 16 " X: 32*512*512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 break " break dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 Xloop 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 Xloop 64 " X: 128*512*512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 unlet p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 break " break main loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 Xloop 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 if (loops > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 Xloop 256 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 while loops == 3 " dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 endwhile " end dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 endwhile " end main loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 Xpath 268435456 " X: 1024*512*512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 Xpath 1073741824 " X: 4096*512*512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 if exists("break_err")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 unlet break_err
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 unlet loops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 Xcheck 1384648195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 " Test 4: :return {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 XloopINIT 2 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 while loops > 0 " 3: 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 Xloop 1 " X: 2 + 2*16 + 0*16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 if (loops == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 Xloop 2 " X: 4*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 Xloop 8 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 Xpath 32768 " X: 8*16*16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 Xcheck 32883
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 " Leave F for execution as a script in the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 " Test 5: :finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 " This test executes the body of the function F from the previous test
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 " as a script file (:return replaced by :finish).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 ExecAsScript F " X: 1 + 2 + 2*16 + 4*16 + 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 unlet loops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 Xcheck 32883
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 " Test 6: Defining functions in :while loops {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 " Functions can be defined inside other functions. An inner function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 " gets defined when the outer function is executed. Functions may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 " also be defined inside while loops. Expressions in braces for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 " defining the function name are allowed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 " The command CALL collects the argument of all its invocations in "calls"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 " when used from a function (that is, when the global variable "calls" needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 " the "g:" prefix). This is to check that the function code is skipped when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 " the function is defined. For inner functions, do so only if the outer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 " function is not being executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 let calls = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 com! -nargs=1 CALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 \ if !exists("calls") && !exists("outer") |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 \ let g:calls = g:calls . <args> |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 \ endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 XloopINIT! 1 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 let i = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 while i < 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 let i = i + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 if i == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 Xloop 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 function! F1(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 CALL a:arg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 let outer = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 XloopINIT! 4096 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 let j = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 while j < 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 Xloop 1 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 let j = j + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 function! G1(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 CALL a:arg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 Xloop 2 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 Xloop 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 Xloop 4 " X: 4 * (16 + 256)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 function! F{i}(i, arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 CALL a:arg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 let outer = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 XloopINIT! 16384 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 if a:i == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 let k = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 while k < 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 Xloop 1 " X: 16384*(1+4+16+64+256+1024)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 let k = k + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 function! G{a:i}{k}(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 CALL a:arg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 Xloop 2 " X: 32768*(1+4+16+64+256+1024)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 Xloop 8 " X: 8 * (16 + 256)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 if exists("*G1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 if exists("*F1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 call F1("F1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 if exists("*G1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 call G1("G1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 if exists("G21") || exists("G21") || exists("G21")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 if exists("*F2")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 call F2(2, "F2")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 if exists("*G21")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 call G21("G21")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 if exists("*G22")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 call G22("G22")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 if exists("*G23")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 call G23("G23")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 if exists("G31") || exists("G31") || exists("G31")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 if exists("*F3")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 call F3(3, "F3")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 if exists("*G31")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 call G31("G31")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 if exists("*G32")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 call G32("G32")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 if exists("*G33")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 call G33("G33")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 if calls != "F1G1F2G21G22G23F3G31G32G33"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 Xout "calls is" calls
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 delfunction F1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 delfunction G1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 delfunction F2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 delfunction G21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 delfunction G22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 delfunction G23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 delfunction G31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 delfunction G32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 delfunction G33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 Xcheck 603978947
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 " Test 7: Continuing on errors outside functions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 " On an error outside a function, the script processing continues
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 " at the line following the outermost :endif or :endwhile. When not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 " inside an :if or :while, the script processing continues at the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 " line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 endwhile | Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 endif | Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 endif | Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 endwhile | Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 asdf | Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 Xcheck 90563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 " Test 8: Aborting and continuing on errors inside functions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 " On an error inside a function without the "abort" attribute, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 " script processing continues at the next line (unless the error was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 " in a :return command). On an error inside a function with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 " "abort" attribute, the function is aborted and the script processing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 " continues after the function call; the value -1 is returned then.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 asdf | Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 endif | Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 asdf | Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 endwhile | Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 return novar " returns (default return value 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 return 1 " not reached
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 function! G() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 asdf " returns -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 endif | Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 Xpath Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 return -4 " not reached
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 function! H() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 asdf " returns -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 endwhile | Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 return -4 " not reached
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 " Aborted functions (G and H) return -1.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 let sum = (F() + 1) - 4*G() - 8*H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 if sum != 13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 Xout "sum is" sum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 unlet sum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 Xcheck 562493431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 " Test 9: Continuing after aborted functions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 " When a function with the "abort" attribute is aborted due to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 " error, the next function back in the call hierarchy without an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 " "abort" attribute continues; the value -1 is returned then.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 function! F() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 let result = G() " not aborted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 if result != 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116 return 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 function! G() " no abort attribute
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 if H() != -1 " aborted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 return 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 function! H() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 call I() " aborted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 return 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 function! I() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 return 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 if F() != 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 delfunction I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 Xcheck 363
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 " Test 10: :if, :elseif, :while argument parsing {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 " A '"' or '|' in an argument expression must not be mixed up with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 " a comment or a next command after a bar. Parsing errors should
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 " be recognized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 if 1 || strlen("\"") | Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 elseif 1 || strlen("\"") | Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 while 1 || strlen("\"") | Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 if 1 ||| strlen("\"") | Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 if !MSG('E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 elseif 1 ||| strlen("\"") | Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 if !MSG('E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 while 1 ||| strlen("\"") | Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 if !MSG('E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 Xcheck 559615
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 " Test 11: :if, :elseif, :while argument evaluation after abort {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 " When code is skipped over due to an error, the boolean argument to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 " an :if, :elseif, or :while must not be evaluated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 let calls = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 function! P(num)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 let g:calls = g:calls + a:num " side effect on call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 if P(1) " should not be called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 elseif !P(2) " should not be called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 while P(4) " should not be called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 if calls % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 if (calls/2) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 if (calls/4) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279 unlet calls
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 delfunction P
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 Xcheck 2049
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 " Test 12: Expressions in braces in skipped code {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 " In code skipped over due to an error or inactive conditional,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 " an expression in braces as part of a variable or function name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 " should not be evaluated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 XloopINIT 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 function! NULL()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 function! ZERO()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 function! F0()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 function! F1(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 let V0 = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 echo 0 ? F{NULL() + V{ZERO()}}() : 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 call F{NULL() + V{ZERO()}}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 call F1(F{NULL() + V{ZERO()}}())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 call F{NULL() + V{ZERO()}}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1343 Xcheck 352256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 " Test 13: Failure in argument evaluation for :while {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 " A failure in the expression evaluation for the condition of a :while
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 " causes the whole :while loop until the matching :endwhile being
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 " ignored. Continuation is at the next following line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 while asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 while asdf | Xpath 32 | endwhile | Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 Xcheck 145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 " Test 14: Failure in argument evaluation for :if {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 " A failure in the expression evaluation for the condition of an :if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 " does not cause the corresponding :else or :endif being matched to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 " a previous :if/:elseif. Neither of both branches of the failed :if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 " are executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 XloopINIT 1 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 Xloop 1 " X: 1 + 256 * 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 let x = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 if x " false
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 Xloop 2 " X: 0 + 256 * 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 elseif !x " always true
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 Xloop 4 " X: 4 + 256 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 let x = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 if g:boolvar " possibly undefined
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 Xloop 8 " X: 8 + 256 * 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 Xloop 16 " X: 0 + 256 * 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 Xloop 32 " X: 32 + 256 * 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 elseif x " never executed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 Xloop 64 " X: 0 + 256 * 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403 Xloop 128 " X: 128 + 256 * 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 let boolvar = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 unlet boolvar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 Xcheck 42413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 " Test 15: Failure in argument evaluation for :if (bar) {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 " Like previous test, except that the failing :if ... | ... | :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 " is in a single line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 XloopINIT 1 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 Xloop 1 " X: 1 + 256 * 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 let x = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 if x " false
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 Xloop 2 " X: 0 + 256 * 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 elseif !x " always true
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 Xloop 4 " X: 4 + 256 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 let x = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 if g:boolvar | Xloop 8 | else | Xloop 16 | endif " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 Xloop 32 " X: 32 + 256 * 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 elseif x " never executed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 Xloop 64 " X: 0 + 256 * 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 Xloop 128 " X: 128 + 256 * 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 let boolvar = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 unlet boolvar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 Xcheck 42413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 " Test 16: Double :else or :elseif after :else {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 " Multiple :elses or an :elseif after an :else are forbidden.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 function! F() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 Xpath 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 else " aborts function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 function! G() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 elseif 1 " aborts function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 function! H() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 elseif 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 else " aborts function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 function! I() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 elseif 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 elseif 1 " aborts function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 call H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 call I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 delfunction I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 Xcheck 8722
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 " Test 17: Nesting of unmatched :if or :endif inside a :while {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 " The :while/:endwhile takes precedence in nesting over an unclosed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 " :if or an unopened :endif.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 let messages = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 " While loops inside a function are continued on error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 XloopINIT 1 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 let loops = loops - 1 " 2: 1: 0:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 Xloop 1 " X: 1 + 1*16 + 1*16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 if (loops == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564 Xloop 2 " X: 2*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 elseif (loops == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 Xloop 4 " X: 4*16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 elseif 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 Xloop 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 " endif missing!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 endwhile " :endwhile after :if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 Xpath 4096 " X: 16*16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 if MSG('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 let g:messages = g:messages . "A"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 XloopINIT! 8192 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582 let loops = 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 while loops > 0 " 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 Xloop 1 " X: 8192 + 8192*4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 " endif missing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 endwhile " :endwhile after :if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 Xpath 131072 " X: 8192*4*4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 if MSG('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593 let g:messages = g:messages . "B"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 XloopINIT 262144 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 let loops = 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 while loops > 0 " 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 Xloop 1 " X: 262144 + 262144 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 " if missing!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 endif " :endif without :if in while
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 Xloop 2 " X: 524288 + 524288 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 Xpath 4194304 " X: 262144*4*4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 if MSG('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 let g:messages = g:messages . "C"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 " Error continuation outside a function is at the outermost :endwhile or :endif.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 XloopINIT! 8388608 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 let loops = 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 while loops > 0 " 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622 Xloop 1 " X: 8388608 + 0 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 " endif missing! Following :endwhile fails.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 endwhile | Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 Xpath 268435456 " X: 2*8388608*4*4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 if MSG('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 let messages = g:messages . "D"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 if messages != "ABCD"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 Xout "messages is" messages "instead of ABCD"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 unlet loops messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 Xcheck 285127993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 " Test 18: Interrupt (Ctrl-C pressed) {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 " On an interrupt, the script processing is terminated immediately.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 endif | Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 endwhile | Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 endif | Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 endtry | Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 endif | Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 Xpath Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 endwhile | Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 Xpath Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 endif | Xpath Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 Xpath Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 call F() | Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 endtry | Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 call G() | Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 " The Xpath command does not accept 2^31 (negative); display explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 exec "!echo 2147483648 >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 Xcheck 67224583
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 " Test 19: Aborting on errors inside :try/:endtry {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 " An error in a command dynamically enclosed in a :try/:endtry region
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 " aborts script processing immediately. It does not matter whether
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 " the failing command is outside or inside a function and whether a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 " function has an "abort" attribute.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 function! F() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 endtry | Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 endtry | Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 endtry | Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 endtry | Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 endif | Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 endtry | Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 endwhile | Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 endwhile | Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 Xcheck 69275973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 " Test 20: Aborting on errors after :try/:endtry {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 " When an error occurs after the last active :try/:endtry region has
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 " been left, termination behavior is as if no :try/:endtry has been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 " seen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 endwhile | Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922 Xcheck 1874575085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 " Test 21: :finally for :try after :continue/:break/:return/:finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1928 " If a :try conditional stays inactive due to a preceding :continue,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 " :break, :return, or :finish, its :finally clause should not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 " executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1933 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936 function F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937 let loops = 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1938 XloopINIT! 1 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1940 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1941 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1943 if loops == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1944 Xloop 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1945 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947 elseif loops == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948 Xloop 4 " X: 4*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953 try " inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1954 Xloop 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1956 Xloop 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959 Xloop 64 " X: 64 + 64*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1961 Xloop 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1964 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 try " inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985 try " inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1988 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996 Xcheck 147932225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 " Test 22: :finally for a :try after an error/interrupt/:throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 " If a :try conditional stays inactive due to a preceding error or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003 " interrupt or :throw, its :finally clause should not be executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009 function! Error()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011 asdf " aborting error, triggering error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2016 call Error()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2017 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019 if 1 " not active due to error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 try " not active due to error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2029 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2034 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 function! Interrupt()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 "INTERRUPT " triggering interrupt exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2039 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2040
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2041 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 call Interrupt()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 if 1 " not active due to interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2047 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2050 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 try " not active due to interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2055 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2056 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061 function! Throw()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 throw "xyz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 call Throw()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069 if 1 " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2073 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 try " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 Xcheck 4161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088 " Test 23: :catch clauses for a :try after a :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 " If a :try conditional stays inactive due to a preceding :throw,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091 " none of its :catch clauses should be executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099 throw "xyz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 if 1 " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2105 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2115 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 try " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 catch /abc/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 Xcheck 49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 " Test 24: :endtry for a :try after a :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130 " If a :try conditional stays inactive due to a preceding :throw,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131 " its :endtry should not rethrow the exception to the next surrounding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132 " active :try conditional.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138 try " try 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139 try " try 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 throw "xyz" " makes try 2 inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 try " try 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 endtry " no rethrow to try 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147 catch /xyz/ " should catch although try 2 inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150 catch /xyz/ " try 1 active, but exception already caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 Xcheck 41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 " Test 25: Executing :finally clauses on normal control flow {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 " Control flow in a :try conditional should always fall through to its
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163 " :finally clause. A :finally clause of a :try conditional inside an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 " inactive conditional should never be executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2171 XloopINIT 1 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2172 while loops > 0 " 3: 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2173 Xloop 1 " X: 1 + 1*256 + 1*256*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2174 if loops >= 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2175 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2176 Xloop 2 " X: 2 + 2*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177 if loops == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2178 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2179 Xloop 4 " X: 4*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181 Xloop 8 " X: 8*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 Xloop 16 " X: 16 + 16*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 if loops == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188 Xloop 32 " X: 32*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 Xloop 64 " X: 64*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 Xloop 128 " X: 128 + 128*256 + 128*256*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2216 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 Xcheck 260177811
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224 " Test 26: Executing :finally clauses after :continue or :break {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 " For a :continue or :break dynamically enclosed in a :try/:endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 " region inside the next surrounding :while/:endwhile, if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 " :continue/:break is before the :finally, the :finally clause is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 " executed first. If the :continue/:break is after the :finally, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 " :finally clause is broken (like an :if/:endif region).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 XloopINIT! 1 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 if loops == 2 " 3: 2: 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 Xloop 1 " X: 1*32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 elseif loops == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 Xloop 2 " X: 2*32*32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2248 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 Xloop 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 Xloop 8 " X: 8 + 8*32 + 8*32*32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 Xloop 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 XloopINIT 131072 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2266 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2267 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2268 if loops == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2269 Xloop 1 " X: 131072*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 elseif loops == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274 Xloop 2 " X: 131072*2*16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 Xloop 4 " X: 131072*4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 Xloop 8 " X: 131072*8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 unlet loops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 Xcheck 1681500476
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 " Test 27: Executing :finally clauses after :return {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 " For a :return command dynamically enclosed in a :try/:endtry region,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 " :finally clauses are executed and the called function is ended.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2310 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2312 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2322 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2328 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2329 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2330 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2338 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2341 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 call H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355 Xcheck 1996459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 " Leave F, G, and H for execution as scripts in the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2359
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2360 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2361 " Test 28: Executing :finally clauses after :finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2362 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2363 " For a :finish command dynamically enclosed in a :try/:endtry region,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 " :finally clauses are executed and the sourced file is finished.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2366 " This test executes the bodies of the functions F, G, and H from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367 " previous test as script files (:return replaced by :finish).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 let scriptF = MakeScript("F") " X: 1 + 2 + 8 + 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373 let scriptG = MakeScript("G", scriptF) " X: 128 + 512 + 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 let scriptH = MakeScript("H", scriptG) " X: 4096 + 8192 + 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 exec "source" scriptH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2382 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2383 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 call delete(scriptF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 call delete(scriptG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387 call delete(scriptH)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388 unlet scriptF scriptG scriptH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2393 Xcheck 1996459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2396 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2397 " Test 29: Executing :finally clauses on errors {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399 " After an error in a command dynamically enclosed in a :try/:endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 " region, :finally clauses are executed and the script processing is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401 " terminated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2407 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2408 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2411 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2413 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2417 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2418 endtry | Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2424 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2425 endtry | Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2429 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2432 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2433 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2434 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2435 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2436 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439 endwhile | Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2440 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2441 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2442 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2443 endtry | Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2444 endwhile | Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2445 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2446 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2447
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2448 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2449 function! G() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2450 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2451 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2452 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2453 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2454 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2455 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2456 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2457 endtry | Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2458 endif | Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2459 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2460 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2462 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2469 endtry | Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 endif | Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 Xcheck 170428555
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 " Test 30: Executing :finally clauses on interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2480 " After an interrupt in a command dynamically enclosed in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2481 " a :try/:endtry region, :finally clauses are executed and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 " script processing is terminated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2487 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488 XloopINIT 1 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2491 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2492 Xloop 1 " X: 1 + 1*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 Xloop 4 " X: 4 + 4*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2498 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2499 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2504 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2506 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2516 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2525 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2526 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2527 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2530 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2531 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2533 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2535 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2537 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 ExecAsScript F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2539 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2542 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2543 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2545 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2546 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550 Xcheck 190905173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 " Test 31: Executing :finally clauses after :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 " After a :throw dynamically enclosed in a :try/:endtry region,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2557 " :finally clauses are executed and the script processing is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558 " terminated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2561 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2564 XloopINIT 1 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2566 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568 Xloop 1 " X: 1 + 1*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569 throw "exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 Xloop 4 " X: 4 + 4*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 throw "exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2591 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2592 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593 throw "exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2594 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2595 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2601 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2602 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2606 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2607 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2612 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2613 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614 ExecAsScript F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2616 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2617 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2619 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2623 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2624 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2625
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2626 Xcheck 190905173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2627
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2628
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2629 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2630 " Test 32: Remembering the :return value on :finally {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2631 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2632 " If a :finally clause is executed due to a :return specifying
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2633 " a value, this is the value visible to the caller if not overwritten
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2634 " by a new :return in the :finally clause. A :return without a value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2635 " in the :finally clause overwrites with value 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2636 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2637
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2638 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 return "ABCD"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2647 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2652 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 return 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664 return 16 + strlen(F())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2666 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2667 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2668 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2670 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2671 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2672 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2673 return 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2677 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2679 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2680 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2683 function! I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 return G() + H() + 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 let retcode = I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 if retcode < 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 if retcode % 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703 if (retcode/4) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 if (retcode/8) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2707 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2709 if (retcode/16) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712 if (retcode/32) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2715 if (retcode/64) % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718 if retcode/128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2719 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2720 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2721
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2722 unlet retcode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2723 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2724 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2725 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2726 delfunction I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2727
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2728 Xcheck 354833067
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2729
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2730
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2731 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2732 " Test 33: :return under :execute or user command and :finally {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2733 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2734 " A :return command may be executed under an ":execute" or from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2735 " a user command. Executing of :finally clauses and passing through
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2736 " the return code works also then.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2737 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2738 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2739
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2740 command! -nargs=? RETURN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741 \ try | return <args> | finally | return <args> * 2 | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2743 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745 RETURN 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2746 Xpath 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2747 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2748 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2749 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2750 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755 RETURN 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2756 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2757 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2758 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2759 RETURN 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2760 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2761 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2762 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2763 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2765 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2766 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2767 execute "try | return 512 | finally | return 1024 | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2768 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2769 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2770 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2771 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2772 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2773 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2775 function! I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2776 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2777 execute "try | return 2048 | finally | return 4096 | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2778 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2779 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2780 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 execute "try | return 8192 | finally | return 16384 | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2783 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2784 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2785 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 function! J()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2788 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 RETURN 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 function! K()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 execute "try | return 131072 | finally | return 262144 | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2803 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 execute "try | return 524288 | finally | return | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 function! L()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817 RETURN 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2819 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2820 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2821 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823 function! M()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2824 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829 execute "try | return 4194304 | finally | return 8388608 | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2830 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 function! N()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 RETURN 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2837 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2838
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 function! O()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840 execute "try | return 67108864 | finally | return 134217728 | endtry"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843 let sum = F() + G() + H() + I() + J() + K() + L() + M()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844 let expected = 16 + 256 + 1024 + 16384 + 0 + 0 + 2097152 + 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845 let sum = sum + N() + O()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 let expected = expected + 33554432 + 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848 if sum == expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 Xout "sum = " . sum . " (ok)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 Xout "sum = " . sum . ", expected: " . expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 if sum != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2859 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 unlet sum expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2864 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2865 delfunction I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2866 delfunction J
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2867 delfunction K
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2868 delfunction L
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2869 delfunction M
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2870 delfunction N
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2871 delfunction O
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2872
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2873 Xcheck 1216907538
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2874
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2875
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2876 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2877 " Test 34: :finally reason discarded by :continue {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2878 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2879 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2880 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2881 " discarded by a :continue in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2882 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2883
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2884 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2885
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2886 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2887
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2888 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2889
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2890 function! C(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2891 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2892 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2893 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2894 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2895 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2896 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2897 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2898 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2899 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2900 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2901 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2902 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2903 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2904 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2905 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2906 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2907 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2908 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2909 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2910 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2911 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2912 continue " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2913 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2914 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2915 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2916 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2917 Xloop 4 " X: 4*(1+8+64+512+4096+32768+262144)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2918 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2919 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2920 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2921
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2922 call C("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2923 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2924 call C("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2925 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2926 call C("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2927 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2928 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2929 ExecAsScript C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2930 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2931 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2932 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2933 call C("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2934 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2935 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2936 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2937 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2938 call C("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2939 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2940 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2941 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2942 call C("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2943 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2944 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2945 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2946 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2947
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2948 delfunction C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2949
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2950 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2951
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2952 Xcheck 2146584868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2953
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2955 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2956 " Test 35: :finally reason discarded by :break {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2957 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2958 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2959 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2960 " discarded by a :break in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2961 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2962
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2963 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2964
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2965 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2966
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2967 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2968
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2969 function! B(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2970 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2971 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2972 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2973 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2974 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2975 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2976 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2977 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2978 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2979 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2980 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2981 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2982 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2983 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2984 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2985 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2986 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2987 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2988 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2989 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2990 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2991 break " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2992 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2993 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2994 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2995 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2996 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2997 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2998 Xloop 4 " X: 4*(1+8+64+512+4096+32768+262144)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2999 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3000
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3001 call B("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3002 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3003 call B("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3004 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3005 call B("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3006 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3007 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3008 ExecAsScript B
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3009 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3010 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3011 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3012 call B("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3013 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3014 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3015 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3016 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3017 call B("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3018 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3019 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3020 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3021 call B("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3022 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3023 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3024 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3025 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3026
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3027 delfunction B
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3028
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3029 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3030
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3031 Xcheck 2146584868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3032
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3034 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3035 " Test 36: :finally reason discarded by :return {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3036 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3037 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3038 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3039 " discarded by a :return in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3040 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3041
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3042 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3044 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3045
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3046 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3047
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3048 function! R(jump, retval) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3049 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3050 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3051 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3052 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3053 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3054 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3055 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3056 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3057 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3058 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3059 elseif a:jump == "return"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3060 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3061 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3062 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3063 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3064 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3065 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3066 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3067 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3068 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3069 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3070 return a:retval " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3071 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3072 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3073 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3074 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3075 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3076 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3077 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3078 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3080 let sum = -R("continue", -8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3081 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3082 let sum = sum - R("break", -16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3083 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3084 let sum = sum - R("return", -32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3085 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3086 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3087 let sum = sum - R("error", -64)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3088 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3089 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3090 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3091 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3092 let sum = sum - R("interrupt", -128)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3093 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3094 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3095 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3096 let sum = sum - R("throw", -256)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3097 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3098 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3099 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3100 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3102 let expected = 8 + 16 + 32 + 64 + 128 + 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3103 if sum != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3104 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3105 Xout "sum =" . sum . ", expected: " . expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3106 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3108 unlet sum expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3109 delfunction R
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3111 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3113 Xcheck 1071644672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3116 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3117 " Test 37: :finally reason discarded by :finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3118 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3119 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3120 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3121 " discarded by a :finish in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3122 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3124 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3126 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3128 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3130 function! F(jump) " not executed as function, transformed to a script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3131 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3132 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3133 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3134 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3135 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3136 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3137 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3138 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3139 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3140 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3141 elseif a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3142 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3143 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3144 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3145 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3146 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3147 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3148 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3149 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3150 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3151 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3152 finish " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3153 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3154 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3155 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3156 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3157 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3158 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3159 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3160 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3162 let scriptF = MakeScript("F")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3163 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3165 let g:jump = "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3166 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3167 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3168 let g:jump = "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3169 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3170 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3171 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3172 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3173 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3174 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3175 let g:jump = "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3176 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3177 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3178 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3179 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3180 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3181 let g:jump = "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3182 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3183 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3184 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3185 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3186 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3187 let g:jump = "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3188 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3189 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3190 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3191 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3192 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3193 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3194 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3195 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3197 call delete(scriptF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3198 unlet scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3200 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3202 Xcheck 1071644672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3203
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3205 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3206 " Test 38: :finally reason discarded by an error {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3207 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3208 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3209 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3210 " discarded by an error in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3211 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3213 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3215 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3217 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3219 function! E(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3220 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3221 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3222 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3223 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3224 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3225 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3226 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3227 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3228 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3229 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3230 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3231 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3232 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3233 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3234 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3235 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3236 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3237 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3238 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3239 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3240 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3241 asdf " error; discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3242 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3243 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3244 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3245 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3246 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3247 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3248 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3250 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3251 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3252 call E("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3253 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3254 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3255 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3256 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3257 call E("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3258 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3259 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3260 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3261 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3262 call E("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3263 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3264 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3265 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3266 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3267 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3268 ExecAsScript E
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3269 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3270 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3271 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3272 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3273 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3274 call E("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3275 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3276 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3277 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3278 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3279 call E("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3280 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3281 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3282 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3283 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3284 call E("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3285 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3286 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3287 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3288 delfunction E
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3289 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3290 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3291 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3292 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3293 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3294 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3295 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3296 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3298 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3300 Xcheck 357908480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3301
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3303 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3304 " Test 39: :finally reason discarded by an interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3305 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3306 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3307 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3308 " discarded by an interrupt in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3309 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3311 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3313 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3315 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3317 function! I(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3318 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3319 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3320 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3321 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3322 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3323 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3324 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3325 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3326 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3327 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3328 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3329 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3330 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3331 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3332 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3333 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3334 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3335 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3336 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3337 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3338 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3339 "INTERRUPT - discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3340 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3341 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3342 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3343 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3344 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3345 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3346 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3347 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3349 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3350 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3351 call I("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3352 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3353 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3354 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3355 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3356 call I("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3357 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3358 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3359 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3360 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3361 call I("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3362 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3363 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3364 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3365 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3366 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3367 ExecAsScript I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3368 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3369 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3370 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3371 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3372 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3373 call I("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3374 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3375 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3376 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3377 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3378 call I("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3379 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3380 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3381 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3382 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3383 call I("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3384 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3385 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3386 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3387 delfunction I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3388 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3389 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3390 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3391 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3392 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3393 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3394 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3395 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3397 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3398
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3399 Xcheck 357908480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3400
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3402 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3403 " Test 40: :finally reason discarded by :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3404 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3405 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3406 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3407 " discarded by a :throw in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3408 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3410 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3412 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3414 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3416 function! T(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3417 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3418 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3419 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3420 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3421 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3422 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3423 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3424 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3425 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3426 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3427 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3428 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3429 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3430 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3431 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3432 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3433 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3434 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3435 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3436 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3437 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3438 throw "xyz" " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3439 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3440 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3441 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3442 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3443 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3444 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3445 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3446
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3447 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3448 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3449 call T("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3450 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3451 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3452 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3453 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3454 call T("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3455 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3456 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3457 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3458 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3459 call T("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3460 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3461 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3462 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3463 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3464 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3465 ExecAsScript T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3466 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3467 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3468 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3469 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3470 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3471 call T("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3472 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3473 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3474 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3475 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3476 call T("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3477 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3478 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3479 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3480 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3481 call T("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3482 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3483 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3484 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3485 delfunction T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3486 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3487 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3488 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3489 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3490 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3491 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3492 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3493 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3494
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3495 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3497 Xcheck 357908480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3499
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3500 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3501 " Test 41: Skipped :throw finding next command {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3502 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3503 " A :throw in an inactive conditional must not hide a following
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3504 " command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3505 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3507 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3509 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3510 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3511 if 0 | throw "never" | endif | Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3512 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3513 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3514
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3515 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3516 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3517 while 0 | throw "never" | endwhile | Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3518 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3519 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3521 function H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3522 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3523 if 0 | try | throw "never" | endtry | endif | Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3524 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3525 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3526
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3527 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3528
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3529 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3530 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3531 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3532 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3533 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3534 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3535 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3536 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3537
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3538 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3540 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3541 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3542 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3543 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3544 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3545 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3546 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3547 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3548
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3549 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3551 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3552 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3553 call H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3554 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3555 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3556 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3557 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3558 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3559
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3560 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3562 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3563 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3564 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3566 Xcheck 3076095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3567
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3569 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3570 " Test 42: Catching number and string exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3571 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3572 " When a number is thrown, it is converted to a string exception.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3573 " Numbers and strings may be caught by specifying a regular exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3574 " as argument to the :catch command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3575 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3577 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3578
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3579 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3580
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3581 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3582 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3583 throw 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3584 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3585 catch /4711/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3586 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3587 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3588
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3589 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3590 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3591 throw 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3592 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3593 catch /^4711$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3594 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3595 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3597 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3598 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3599 throw 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3600 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3601 catch /\d/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3602 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3603 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3605 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3606 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3607 throw 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3608 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3609 catch /^\d\+$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3610 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3611 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3612
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3613 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3614 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3615 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3616 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3617 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3618 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3619 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3620
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3621 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3622 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3623 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3624 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3625 catch /^arrgh$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3626 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3627 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3628
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3629 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3630 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3631 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3632 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3633 catch /\l/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3634 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3635 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3637 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3638 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3639 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3640 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3641 catch /^\l\+$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3642 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3643 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3644
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3645 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3646 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3647 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3648 throw "ARRGH"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3649 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3650 catch /^arrgh$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3651 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3652 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3653 catch /^\carrgh$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3654 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3655 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3657 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3658 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3659 throw ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3660 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3661 catch /^$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3662 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3663 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3665 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3666 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3667 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3668 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3669 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3670
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3671 Xcheck 1505155949
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3674 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3675 " Test 43: Selecting the correct :catch clause {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3676 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3677 " When an exception is thrown and there are multiple :catch clauses,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3678 " the first matching one is taken.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3679 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3680
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3681 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3682
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3683 XloopINIT 1 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3684 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3685 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3686 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3687 if loops == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3688 Xloop 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3689 throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3690 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3691 elseif loops == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3692 Xloop 4 " X: 4*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3693 throw "ab"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3694 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3695 elseif loops == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3696 Xloop 16 " X: 16*1024*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3697 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3698 Xloop 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3699 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3700 catch /abc/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3701 Xloop 64 " X: 64*1024*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3702 catch /ab/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3703 Xloop 128 " X: 128*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3704 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3705 Xloop 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3706 catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3707 Xloop 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3708 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3710 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3711 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3712 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3713 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3714
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3715 unlet loops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3716
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3717 Xcheck 1157763329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3718
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3719
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3720 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3721 " Test 44: Missing or empty :catch patterns {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3722 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3723 " A missing or empty :catch pattern means the same as /.*/, that is,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3724 " catches everything. To catch only empty exceptions, /^$/ must be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3725 " used. A :catch with missing, empty, or /.*/ argument also works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3726 " when followed by another command separated by a bar on the same
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3727 " line. :catch patterns cannot be specified between ||. But other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3728 " pattern separators can be used instead of //.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3729 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3730
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3731 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3732
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3733 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3734 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3735 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3736 throw ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3737 catch /^$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3738 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3739 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3741 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3742 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3743 throw ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3744 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3745 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3746 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3747
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3748 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3749 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3750 throw ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3751 catch //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3752 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3753 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3754
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3755 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3756 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3757 throw ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3758 catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3759 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3760 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3761
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3762 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3763 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3764 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3765 catch /^$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3766 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3767 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3768 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3769 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3770
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3771 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3772 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3773 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3774 catch /^$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3775 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3776 catch //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3777 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3778 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3780 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3781 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3782 throw "brrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3783 catch /^$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3784 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3785 catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3786 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3787 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3788
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3789 try | Xpath 131072 | throw "x" | catch /.*/ | Xpath 262144 | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3790 " X: 131072 + 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3791
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3792 try | Xpath 524288 | throw "y" | catch // | Xpath 1048576 | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3793 " X: 524288 + 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3794
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3795 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3796 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3797 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3798 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3799 " Extra try level: if ":catch" without arguments below raises
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3800 " a syntax error because it misinterprets the "Xpath" as a pattern,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3801 " let it be caught by the ":catch /.*/" below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3802 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3803 try | Xpath 2097152 | throw "z" | catch | Xpath 4194304 | :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3804 endtry " X: 2097152 + 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3805 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3806 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3807 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3808 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3809 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3810 if $VIMNOERRTHROW && v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3811 Xout v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3812 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3813 if caught || $VIMNOERRTHROW && v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3814 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3815 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3816 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3817 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3818 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3820 let cologne = 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3821 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3822 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3823 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3824 throw "throw cologne"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3825 " Next lines catches all and throws 4711:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3826 catch |throw cologne|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3827 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3828 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3829 catch /4711/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3830 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3831 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3832
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3833 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3834 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3835 throw "plus"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3836 catch +plus+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3837 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3838 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3839
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3840 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3841 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3842 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3843 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3844 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3845
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3846 unlet! caught cologne
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3847
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3848 Xcheck 1031761407
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3849
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3850
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3851 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3852 " Test 45: Catching exceptions from nested :try blocks {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3853 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3854 " When :try blocks are nested, an exception is caught by the innermost
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3855 " try conditional that has a matching :catch clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3856 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3857
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3858 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3860 XloopINIT 1 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3861 let loops = 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3862 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3863 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3864 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3865 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3866 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3867 if loops == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3868 Xloop 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3869 throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3870 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3871 elseif loops == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3872 Xloop 4 " X: 4*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3873 throw "ab"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3874 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3875 elseif loops == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3876 Xloop 16 " X: 16*1024*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3877 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3878 Xloop 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3879 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3880 catch /abc/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3881 Xloop 64 " X: 64*1024*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3882 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3883 catch /ab/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3884 Xloop 128 " X: 128*1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3885 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3886 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3887 Xloop 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3888 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3889 catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3890 Xloop 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3891 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3892
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3893 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3894 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3895 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3896 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3897
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3898 unlet loops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3899
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3900 Xcheck 1157763329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3901
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3902
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3903 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3904 " Test 46: Executing :finally after a :throw in nested :try {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3905 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3906 " When an exception is thrown from within nested :try blocks, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3907 " :finally clauses of the non-catching try conditionals should be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3908 " executed before the matching :catch of the next surrounding :try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3909 " gets the control. If this also has a :finally clause, it is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3910 " executed afterwards.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3911 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3913 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3914
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3915 let sum = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3916
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3917 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3918 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3919 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3920 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3921 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3922 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3923 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3924 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3925 throw "ABC"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3926 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3927 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3928 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3929 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3930 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3931 if sum != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3932 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3933 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3934 let sum = sum + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3935 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3936 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3937 catch /123/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3938 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3939 catch /321/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3940 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3941 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3942 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3943 if sum != 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3944 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3945 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3946 let sum = sum + 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3947 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3948 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3949 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3950 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3951 if sum != 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3952 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3953 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3954 let sum = sum + 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3955 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3956 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3957 catch /ABC/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3958 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3959 if sum != 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3960 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3961 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3962 let sum = sum + 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3963 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3964 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3965 if sum != 15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3966 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3967 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3968 let sum = sum + 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3969 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3970 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3971 if sum != 31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3972 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3973 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3974
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3975 unlet sum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3976
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3977 Xcheck 739407
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3978
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3980 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3981 " Test 47: Throwing exceptions from a :catch clause {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3982 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3983 " When an exception is thrown from a :catch clause, it should not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3984 " caught by a :catch of the same :try conditional. After executing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3985 " the :finally clause (if present), surrounding try conditionals
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3986 " should be checked for a matching :catch.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3987 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3989 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3990
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3991 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3992 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3993 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3994 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3995 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3996 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3997 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3998 throw "x1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3999 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4000 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4001 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4002 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4003 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4004 throw "x2"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4005 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4006 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4007 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4008 catch /x2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4009 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4010 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4011 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4012 throw "x3"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4013 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4014 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4015 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4016 catch /x2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4017 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4018 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4019 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4020 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4021 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4022 catch /x3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4023 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4024 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4025 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4026 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4027 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4028 catch /x2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4029 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4030 catch /x3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4031 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4032 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4033 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4034 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4035 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4036 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4037 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4038 catch /x2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4039 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4040 catch /x3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4041 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4042 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4043 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4044 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4045 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4046 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4047 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4048 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4049
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4050 Xcheck 371213935
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4051
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4052
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4053 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4054 " Test 48: Throwing exceptions from a :finally clause {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4055 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4056 " When an exception is thrown from a :finally clause, it should not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4057 " caught by a :catch of the same :try conditional. Surrounding try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4058 " conditionals should be checked for a matching :catch. A previously
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4059 " thrown exception is discarded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4060 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4061
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4062 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4064 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4065
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4066 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4067 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4068 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4069 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4070 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4071 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4072 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4073 throw "x1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4074 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4075 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4076 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4077 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4078 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4079 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4080 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4082 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4083 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4084 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4085 throw "x2"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4086 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4087 catch /x2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4088 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4089 catch /x3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4090 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4091 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4092 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4093 throw "x3"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4094 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4095 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4096 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4097 catch /x2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4098 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4099 catch /x3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4100 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4101 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4102 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4104 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4105 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4106 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4107 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4108 throw "x4"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4109 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4110 catch /x5/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4111 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4112 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4113 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4114 throw "x5" " discards "x4"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4115 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4116 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4117 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4118 catch /x4/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4119 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4120 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4121 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4122 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4123 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4124 catch /x5/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4125 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4126 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4127 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4129 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4130 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4131 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4132 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4133 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4135 Xcheck 756255461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4138 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4139 " Test 49: Throwing exceptions across functions {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4140 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4141 " When an exception is thrown but not caught inside a function, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4142 " caller is checked for a matching :catch clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4143 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4145 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4147 function! C()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4148 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4149 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4150 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4151 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4152 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4153 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4154 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4155 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4156 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4158 XloopINIT! 16 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4160 function! T1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4161 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4162 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4163 Xloop 1 " X: 16 + 16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4164 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4165 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4166 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4167 Xloop 4 " X: 64 + 64*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4168 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4169 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4170 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4172 function! T2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4173 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4174 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4175 call T1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4176 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4177 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4178 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4179 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4180 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4181 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4183 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4184 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4185 call C() " throw and catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4186 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4187 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4188 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4189 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4190 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4192 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4193 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4194 call T1() " throw, one level
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4195 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4196 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4197 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4198 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4199 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4200 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4201 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4203 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4204 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4205 call T2() " throw, two levels
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4206 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4207 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4208 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4209 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4210 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4211 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4212 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4213 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4215 Xcheck 179000669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4217 " Leave C, T1, and T2 for execution as scripts in the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4220 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4221 " Test 50: Throwing exceptions across script files {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4222 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4223 " When an exception is thrown but not caught inside a script file,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4224 " the sourcing script or function is checked for a matching :catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4225 " clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4226 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4227 " This test executes the bodies of the functions C, T1, and T2 from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4228 " the previous test as script files (:return replaced by :finish).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4229 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4231 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4233 let scriptC = MakeScript("C") " X: 1 + 4 + 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4234 delfunction C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4236 XloopINIT! 16 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4238 let scriptT1 = MakeScript("T1") " X: 16 + 64 + 16*16 + 64*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4239 delfunction T1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4241 let scriptT2 = MakeScript("T2", scriptT1) " X: 4096 + 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4242 delfunction T2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4244 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4245 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4246 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4247 exec "source" g:scriptC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4248 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4249 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4250 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4251 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4252 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4253
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4254 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4255 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4256 exec "source" g:scriptT1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4257 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4258 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4259 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4260 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4261 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4262 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4263 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4264 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4266 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4267 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4268 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4269 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4270 exec "source" scriptT2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4271 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4272 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4273 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4274 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4275 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4276 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4277 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4278 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4280 call delete(scriptC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4281 call delete(scriptT1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4282 call delete(scriptT2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4283 unlet scriptC scriptT1 scriptT2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4284 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4286 Xcheck 363550045
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4289 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4290 " Test 51: Throwing exceptions across :execute and user commands {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4291 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4292 " A :throw command may be executed under an ":execute" or from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4293 " a user command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4294 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4296 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4298 command! -nargs=? THROW1 throw <args> | throw 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4299 command! -nargs=? THROW2 try | throw <args> | endtry | throw 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4300 command! -nargs=? THROW3 try | throw 3 | catch /3/ | throw <args> | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4301 command! -nargs=? THROW4 try | throw 4 | finally | throw <args> | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4303 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4305 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4306 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4307 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4308 THROW1 "A"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4309 catch /A/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4310 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4311 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4312 catch /1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4313 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4314 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4316 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4317 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4318 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4319 THROW2 "B"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4320 catch /B/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4321 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4322 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4323 catch /2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4324 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4325 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4327 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4328 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4329 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4330 THROW3 "C"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4331 catch /C/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4332 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4333 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4334 catch /3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4335 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4336 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4337
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4338 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4339 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4340 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4341 THROW4 "D"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4342 catch /D/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4343 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4344 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4345 catch /4/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4346 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4347 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4349 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4350 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4351 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4352 execute 'throw "E" | throw 5'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4353 catch /E/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4354 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4355 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4356 catch /5/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4357 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4358 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4359
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4360 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4361 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4362 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4363 execute 'try | throw "F" | endtry | throw 6'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4364 catch /F/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4365 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4366 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4367 catch /6/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4368 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4369 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4371 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4372 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4373 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4374 execute'try | throw 7 | catch /7/ | throw "G" | endtry'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4375 catch /G/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4376 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4377 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4378 catch /7/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4379 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4380 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4381
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4382 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4383 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4384 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4385 execute 'try | throw 8 | finally | throw "H" | endtry'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4386 catch /H/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4387 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4388 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4389 catch /8/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4390 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4391 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4393 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4394 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4395 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4396 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4398 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4400 delcommand THROW1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4401 delcommand THROW2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4402 delcommand THROW3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4403 delcommand THROW4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4404
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4405 Xcheck 40744667
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4407
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4408 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4409 " Test 52: Uncaught exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4410 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4411 " When an exception is thrown but not caught, an error message is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4412 " displayed when the script is terminated. In case of an interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4413 " or error exception, the normal interrupt or error message(s) are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4414 " displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4415 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4417 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4418
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4419 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4420
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4421 function! MESSAGES(...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4422 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4423 exec "edit" g:msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4424 catch /^Vim(edit):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4425 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4426 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4428 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4429 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4430 norm gg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4432 let num = a:0 / 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4433 let cnt = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4434 while cnt <= num
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4435 let enr = a:{2*cnt - 1}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4436 let emsg= a:{2*cnt}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4437 let cnt = cnt + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4438
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4439 if enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4440 Xout "TODO: Add message number for:" emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4441 elseif enr == "INT"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4442 let enr = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4443 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4444 if enr == "" && !english
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4445 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4446 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4447 let pattern = (enr != "") ? enr . ':.*' : ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4448 if english
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4449 let pattern = pattern . emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4450 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4451 if !search(pattern, "W")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4452 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4453 Xout "No match for:" pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4454 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4455 norm $
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4456 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4457
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4458 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4459 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4460 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4462 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4463 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4464 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4465 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4467 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4468 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4469 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4470 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4471
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4472 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4473 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4474 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4475 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4476 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4477 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4478 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4479 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4480 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4482 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4483 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4484 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4485 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4487 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4488 function! T()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4489 throw "brrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4490 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4491
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4492 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4493 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4494 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4495 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4496 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4497 call T()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4498 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4499 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4500 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4501
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4502 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4503 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4504 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4505 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4507 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4508 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4509 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4510 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4511 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4512 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4513 throw "brrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4514 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4515 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4516 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4518 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4519 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4520 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4521 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4523 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4524 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4525 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4526 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4527 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4528 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4529 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4530
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4531 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4532 if !MESSAGES('INT', "Interrupted")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4533 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4534 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4535
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4536 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4537 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4538 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4539 let x = novar " error E121/E15; exception: E121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4540 catch /E15:/ " should not catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4541 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4542 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4543 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4544 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4546 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4547 if !MESSAGES('E121', "Undefined variable", 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4548 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4549 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4551 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4552 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4553 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4554 " unlet novar # " error E108/E488; exception: E488
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4555 catch /E108:/ " should not catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4556 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4557 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4558 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4559 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4561 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4562 if !MESSAGES('E108', "No such variable", 'E488', "Trailing characters")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4563 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4564 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4565 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4567 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4568 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4570 Xcheck 1247112011
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4571
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4572 " Leave MESSAGES() for the next tests.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4573
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4575 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4576 " Test 53: Nesting errors: :endif/:else/:elseif {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4577 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4578 " For nesting errors of :if conditionals the correct error messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4579 " should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4580 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4581 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4582 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4583 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4585 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4586
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4587 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4588
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4589 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4590 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4591 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4592 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4593 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4594 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4595
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4596 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4597 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4598 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4599 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4600 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4601 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4602 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4603 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4605 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4606 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4607 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4608 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4609 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4610 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4611 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4612 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4613 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4615 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4616 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4617 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4618 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4619 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4620 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4621 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4622 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4624 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4625 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4626 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4627 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4628 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4629 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4630 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4631 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4632 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4633 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4634
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4635 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4636 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4637 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4638 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4639 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4640 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4641
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4642 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4643 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4644 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4645 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4646 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4647 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4648 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4649 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4650
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4651 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4652 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4653 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4654 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4655 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4656 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4657 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4658 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4659 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4660
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4661 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4662 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4663 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4664 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4665 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4666 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4667 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4668 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4670 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4671 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4672 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4673 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4674 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4675 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4676 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4677 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4678 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4679 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4680
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4681 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4682 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4683 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4684 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4685 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4686 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4687
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4688 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4689 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4690 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4691 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4692 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4693 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4694 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4695 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4697 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4698 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4699 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4700 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4701 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4702 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4703 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4704 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4705 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4706
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4707 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4708 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4709 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4710 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4711 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4712 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4713 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4714 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4716 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4717 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4718 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4719 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4720 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4721 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4722 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4723 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4724 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4725 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4726
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4727 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4728 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4729 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4730 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4731 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4732 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4733 if MESSAGES('E583', "multiple :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4734 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4735 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4736
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4737 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4738 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4739 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4740 " elseif 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4741 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4742 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4743 if MESSAGES('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4744 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4745 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4746
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4747 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4748 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4749
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4750 Xcheck 131071
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4752 " Leave MESSAGES() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4753
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4754
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4755 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4756 " Test 54: Nesting errors: :while/:endwhile {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4757 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4758 " For nesting errors of :while conditionals the correct error messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4759 " should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4760 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4761 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4762 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4763 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4764
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4765 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4766
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4767 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4769 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4770 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4771 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4772 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4773 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4774 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4775
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4776 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4777 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4778 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4779 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4780 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4781 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4782 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4783 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4784
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4785 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4786 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4787 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4788 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4789 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4790 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4791 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4792 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4793
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4794 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4795 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4796 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4797 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4798 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4799 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4800 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4801 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4802 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4803
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4804 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4805 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4806 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4807 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4808 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4809 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4810 if MESSAGES('E600', "Missing :endtry")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4811 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4812 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4813
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4814 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4815 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4816 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4817 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4818 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4819 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4820 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4821 if MESSAGES('E600', "Missing :endtry")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4822 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4823 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4825 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4826 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4827 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4828 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4829 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4830 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4831 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4832 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4833 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4834 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4836 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4837 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4838 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4839 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4840 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4841 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4842 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4843 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4844
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4845 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4846 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4847 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4848 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4849 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4850 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4851 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4852 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4853 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4854 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4856 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4857 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4858 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4859 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4860 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4861 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4862 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4863 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4864 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4865 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4866
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4867 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4868 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4869 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4870 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4871 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4872 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4873 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4874 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4875 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4876 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4877 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4878 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4879
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4880
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4881 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4882 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4883
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4884 Xcheck 2047
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4885
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4886 " Leave MESSAGES() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4887
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4888
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4889 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4890 " Test 55: Nesting errors: :continue/:break {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4891 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4892 " For nesting errors of :continue and :break commands the correct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4893 " error messages should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4894 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4895 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4896 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4897 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4898
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4899 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4900
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4901 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4902
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4903 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4904 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4905 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4906 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4907 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4908 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4909
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4910 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4911 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4912 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4913 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4914 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4915 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4916 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4917 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4918
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4919 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4920 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4921 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4922 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4923 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4924 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4925 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4926 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4927 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4928
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4929 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4930 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4931 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4932 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4933 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4934 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4935 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4936 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4937
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4938 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4939 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4940 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4941 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4942 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4943 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4944 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4945 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4946 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4947 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4949 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4950 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4951 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4952 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4953 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4954 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4955
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4956 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4957 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4958 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4959 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4960 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4961 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4962 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4963 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4964
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4965 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4966 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4967 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4968 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4969 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4970 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4971 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4972 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4973 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4974
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4975 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4976 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4977 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4978 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4979 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4980 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4981 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4982 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4983
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4984 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4985 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4986 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4987 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4988 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4989 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4990 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4991 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4992 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4993 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4994
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4995 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4996 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4998 Xcheck 1023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4999
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5000 " Leave MESSAGES() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5003 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5004 " Test 56: Nesting errors: :endtry {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5005 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5006 " For nesting errors of :try conditionals the correct error messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5007 " should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5008 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5009 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5010 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5011 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5012
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5013 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5014
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5015 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5017 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5018 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5019 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5020 if MESSAGES('E602', ":endtry without :try")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5021 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5022 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5024 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5025 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5026 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5027 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5028 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5029 if MESSAGES('E602', ":endtry without :try")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5030 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5031 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5032
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5033 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5034 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5035 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5036 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5037 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5038 if MESSAGES('E602', ":endtry without :try")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5039 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5040 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5041
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5042 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5043 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5044 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5045 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5046 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5047 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5048 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5049 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5050
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5051 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5052 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5053 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5054 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5055 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5056 if MESSAGES('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5057 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5058 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5059
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5060 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5061 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5062 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5063 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5064 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5065 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5066 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5067 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5068 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5070 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5071 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5072 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5073 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5074 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5075 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5076 if MESSAGES('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5077 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5078 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5080 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5081 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5082 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5083 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5084 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5085 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5086 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5087 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5088 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5089 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5090
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5091 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5092 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5093 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5094 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5095 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5096 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5097 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5098 if MESSAGES('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5099 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5100 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5102 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5103 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5105 delfunction MESSAGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5107 Xcheck 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5110 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5111 " Test 57: v:exception and v:throwpoint for user exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5112 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5113 " v:exception evaluates to the value of the exception that was caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5114 " most recently and is not finished. (A caught exception is finished
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5115 " when the next ":catch", ":finally", or ":endtry" is reached.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5116 " v:throwpoint evaluates to the script/function name and line number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5117 " where that exception has been thrown.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5118 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5120 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5122 function! FuncException()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5123 let g:exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5124 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5126 function! FuncThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5127 let g:throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5128 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5130 let scriptException = MakeScript("FuncException")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5131 let scriptThrowPoint = MakeScript("FuncThrowpoint")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5133 command! CmdException let g:exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5134 command! CmdThrowpoint let g:throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5136 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5138 function! CHECK(n, exception, throwname, throwline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5139 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5140 let error = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5141 if v:exception != a:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5142 Xout a:n.": v:exception is" v:exception "instead of" a:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5143 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5144 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5145 if v:throwpoint !~ a:throwname
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5146 let name = escape(a:throwname, '\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5147 Xout a:n.": v:throwpoint (".v:throwpoint.") does not match" name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5148 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5149 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5150 if v:throwpoint !~ a:throwline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5151 let line = escape(a:throwline, '\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5152 Xout a:n.": v:throwpoint (".v:throwpoint.") does not match" line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5153 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5154 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5155 if error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5156 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5157 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5158 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5160 function! T(arg, line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5161 if a:line == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5162 throw a:arg " in line 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5163 elseif a:line == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5164 throw a:arg " in line 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5165 elseif a:line == 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5166 throw a:arg " in line 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5167 elseif a:line == 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5168 throw a:arg " in line 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5169 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5170 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5172 function! G(arg, line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5173 call T(a:arg, a:line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5174 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5176 function! F(arg, line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5177 call G(a:arg, a:line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5178 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5179
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5180 let scriptT = MakeScript("T")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5181 let scriptG = MakeScript("G", scriptT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5182 let scriptF = MakeScript("F", scriptG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5184 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5185 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5186 call F("oops", 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5187 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5188 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5189 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5190 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5191 call CHECK(1, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5192 exec "let exception = v:exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5193 exec "let throwpoint = v:throwpoint"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5194 call CHECK(2, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5195 CmdException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5196 CmdThrowpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5197 call CHECK(3, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5198 call FuncException()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5199 call FuncThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5200 call CHECK(4, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5201 exec "source" scriptException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5202 exec "source" scriptThrowPoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5203 call CHECK(5, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5204 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5205 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5206 call G("arrgh", 4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5207 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5208 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5209 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5210 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5211 call CHECK(6, "arrgh", '\<G\.\.T\>', '\<4\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5212 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5213 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5214 let g:arg = "autsch"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5215 let g:line = 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5216 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5217 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5218 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5219 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5220 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5221 " Symbolic links in tempname()s are not resolved, whereas resolving
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5222 " is done for v:throwpoint. Resolve the temporary file name for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5223 " scriptT, so that it can be matched against v:throwpoint.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5224 call CHECK(7, "autsch", resolve(scriptT), '\<6\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5225 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5226 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5227 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5228 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5229 call CHECK(8, "arrgh", '\<G\.\.T\>', '\<4\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5230 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5231 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5232 let g:arg = "brrrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5233 let g:line = 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5234 exec "source" scriptG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5235 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5236 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5237 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5238 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5239 " Resolve scriptT for matching it against v:throwpoint.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5240 call CHECK(9, "brrrr", resolve(scriptT), '\<8\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5241 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5242 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5243 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5244 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5245 call CHECK(10, "arrgh", '\<G\.\.T\>', '\<4\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5246 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5247 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5248 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5249 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5250 call CHECK(11, "arrgh", '\<G\.\.T\>', '\<4\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5251 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5252 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5253 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5254 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5255 call CHECK(12, "arrgh", '\<G\.\.T\>', '\<4\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5256 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5257 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5258 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5259 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5260 call CHECK(13, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5261 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5262 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5263 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5264 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5265 call CHECK(14, "oops", '\<F\.\.G\.\.T\>', '\<2\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5266 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5267 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5268 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5269 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5270 call CHECK(15, "", '^$', '^$')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5271 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5273 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5275 unlet exception throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5276 delfunction FuncException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5277 delfunction FuncThrowpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5278 call delete(scriptException)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5279 call delete(scriptThrowPoint)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5280 unlet scriptException scriptThrowPoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5281 delcommand CmdException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5282 delcommand CmdThrowpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5283 delfunction T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5284 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5285 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5286 call delete(scriptT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5287 call delete(scriptG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5288 call delete(scriptF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5289 unlet scriptT scriptG scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5291 Xcheck 2147450880
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5294 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5295 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5296 " Test 58: v:exception and v:throwpoint for error/interrupt exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5297 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5298 " v:exception and v:throwpoint work also for error and interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5299 " exceptions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5300 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5301
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5302 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5303
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5304 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5305
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5306 function! T(line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5307 if a:line == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5308 delfunction T " error (function in use) in line 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5309 elseif a:line == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5310 let dummy = 0 " INTERRUPT1 - interrupt in line 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5311 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5312 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5314 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5315 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5316 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5317 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5318 call T(2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5319 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5320 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5321 if v:exception !~ 'Vim(delfunction):'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5322 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5323 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5324 if v:throwpoint !~ '\<T\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5325 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5326 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5327 if v:throwpoint !~ '\<2\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5328 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5329 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5330 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5331 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5332 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5333 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5334 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5335 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5336 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5337 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5338 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5339 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5340 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5341 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5342 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5343 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5345 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5346 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5347 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5348 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5349 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5350 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5351 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5353 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5354 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5355 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5356 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5357 call T(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5358 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5359 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5360 if v:exception != 'Vim:Interrupt'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5361 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5362 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5363 if v:throwpoint !~ '\<T\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5364 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5365 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5366 if v:throwpoint !~ '\<4\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5367 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5368 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5369 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5370 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5371 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5372 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5373 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5374 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5375 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5376 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5377 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5378 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5379 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5380 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5381 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5382 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5383
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5384 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5385 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5386 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5387 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5388 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5389 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5390 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5392 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5393
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5394 Xcheck 624945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5397 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5398 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5399 " Test 59: v:exception and v:throwpoint when discarding exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5400 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5401 " When a :catch clause is left by a ":break" etc or an error or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5402 " interrupt exception, v:exception and v:throwpoint are reset. They
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5403 " are not affected by an exception that is discarded before being
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5404 " caught.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5405 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5407 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5409 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5411 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5413 let sfile = expand("<sfile>")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5415 function! LineNumber()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5416 return substitute(substitute(v:throwpoint, g:sfile, '', ""),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5417 \ '\D*\(\d*\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5418 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5420 command! -nargs=1 SetLineNumber
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5421 \ try | throw "line" | catch /.*/ | let <args> = LineNumber() | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5422
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5423 " Check v:exception/v:throwpoint against second/fourth parameter if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5424 " specified, check for being empty else.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5425 function! CHECK(n, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5426 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5427 let exception = a:0 != 0 ? a:1 : "" " second parameter (optional)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5428 let emsg = a:0 != 0 ? a:2 : "" " third parameter (optional)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5429 let line = a:0 != 0 ? a:3 : 0 " fourth parameter (optional)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5430 let error = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5431 if emsg != ""
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
5432 " exception is the error number, emsg the English error message text
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5433 if exception !~ '^E\d\+$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5434 Xout "TODO: Add message number for:" emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5435 elseif v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5436 if exception == "E492" && emsg == "Not an editor command"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5437 let exception = '^Vim:' . exception . ': ' . emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5438 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5439 let exception = '^Vim(\a\+):' . exception . ': ' . emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5440 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5441 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5442 if exception == "E492"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5443 let exception = '^Vim:' . exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5444 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5445 let exception = '^Vim(\a\+):' . exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5446 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5447 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5448 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5449 if exception == "" && v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5450 Xout a:n.": v:exception is set:" v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5451 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5452 elseif exception != "" && v:exception !~ exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5453 Xout a:n.": v:exception (".v:exception.") does not match" exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5454 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5455 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5456 if line == 0 && v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5457 Xout a:n.": v:throwpoint is set:" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5458 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5459 elseif line != 0 && v:throwpoint !~ '\<' . line . '\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5460 Xout a:n.": v:throwpoint (".v:throwpoint.") does not match" line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5461 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5462 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5463 if !error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5464 Xloop 1 " X: 2097151
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5465 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5466 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5467
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5468 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5469 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5470 throw "x1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5471 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5472 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5473 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5474 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5475 call CHECK(1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5476
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5477 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5478 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5479 throw "x2"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5480 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5481 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5482 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5483 call CHECK(2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5484 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5485 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5486 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5487 call CHECK(3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5488
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5489 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5490 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5491 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5492 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5493 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5494 throw "x3"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5495 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5496 SetLineNumber line_before_error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5497 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5498 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5499 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5500 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5501 call CHECK(4, 'E492', "Not an editor command",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5502 \ line_before_error + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5503 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5504 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5505 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5506 call CHECK(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5507 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5508 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5509 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5510 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5511 call CHECK(5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5513 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5514
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5515 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5516 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5517 let intcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5518 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5519 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5520 throw "x4"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5521 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5522 SetLineNumber two_lines_before_interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5523 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5524 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5525 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5526 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5527 let intcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5528 call CHECK(6, "Vim:Interrupt", '',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5529 \ two_lines_before_interrupt + 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5530 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5531 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5532 if !intcaught && $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5533 call CHECK(6)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5534 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5535 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5536 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5537 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5538 call CHECK(7)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5540 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5541
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5542 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5543 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5544 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5545 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5546 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5547 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5548 SetLineNumber line_before_throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5549 throw "x5"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5550 " missing endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5551 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5552 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5553 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5554 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5555 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5556 call CHECK(8, 'E171', "Missing :endif", line_before_throw + 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5557 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5558 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5559 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5560 call CHECK(8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5561 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5562 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5563 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5564 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5565 call CHECK(9)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5567 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5569 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5570 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5571 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5572 throw "x6"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5573 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5574 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5575 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5576 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5577 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5578 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5579 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5580 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5581 call CHECK(10)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5583 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5584 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5585 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5586 throw "x7"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5587 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5588 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5589 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5590 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5591 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5592 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5593 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5594 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5595 call CHECK(11)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5596 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5597 call CHECK(12)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5599 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5600 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5601 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5602 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5603 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5604 throw "x8"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5605 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5606 SetLineNumber line_before_error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5607 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5608 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5609 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5610 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5611 call CHECK(13, 'E492', "Not an editor command",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5612 \ line_before_error + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5613 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5614 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5615 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5616 call CHECK(13)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5617 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5618 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5619 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5620 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5621 call CHECK(14)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5623 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5624
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5625 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5626 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5627 let intcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5628 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5629 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5630 throw "x9"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5631 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5632 SetLineNumber two_lines_before_interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5633 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5634 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5635 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5636 let intcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5637 call CHECK(15, "Vim:Interrupt", '',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5638 \ two_lines_before_interrupt + 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5639 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5640 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5641 if !intcaught && $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5642 call CHECK(15)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5643 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5644 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5645 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5646 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5647 call CHECK(16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5649 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5650
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5651 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5652 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5653 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5654 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5655 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5656 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5657 SetLineNumber line_before_throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5658 throw "x10"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5659 " missing endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5660 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5661 call CHECK(17)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5662 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5663 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5664 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5665 call CHECK(18, 'E171', "Missing :endif", line_before_throw + 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5666 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5667 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5668 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5669 call CHECK(18)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5670 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5671 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5672 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5673 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5674 call CHECK(19)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5675
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5676 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5678 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5679 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5680 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5681 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5682 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5683 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5684 SetLineNumber line_before_throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5685 throw "x11"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5686 " missing endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5687 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5688 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5689 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5690 call CHECK(20, 'E171', "Missing :endif", line_before_throw + 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5691 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5692 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5693 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5694 call CHECK(20)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5695 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5696 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5697 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5698 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5699 call CHECK(21)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5700
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5701 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5702
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5703 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5704
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5705 Xcheck 2038431743
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5706
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5707
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5708 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5709 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5710 " Test 60: (Re)throwing v:exception; :echoerr. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5711 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5712 " A user exception can be rethrown after catching by throwing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5713 " v:exception. An error or interrupt exception cannot be rethrown
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5714 " because Vim exceptions cannot be faked. A Vim exception using the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5715 " value of v:exception can, however, be triggered by the :echoerr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5716 " command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5717 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5718
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5719 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5721 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5722 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5723 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5724 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5725 catch /oops/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5726 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5727 throw v:exception " rethrow user exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5728 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5729 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5730 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5731 catch /^oops$/ " catches rethrown user exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5732 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5733 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5734 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5735 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5736
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5737 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5738 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5739 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5740 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5741 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5742 write /n/o/n/w/r/i/t/a/b/l/e/_/f/i/l/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5743 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5744 Xout "did_emsg was reset before executing " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5745 \ "BufWritePost autocommands."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5746 catch /^Vim(write):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5747 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5748 throw v:exception " throw error: cannot fake Vim exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5749 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5750 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5751 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5752 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5753 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5754 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5755 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5756 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5757 catch /^Vim(throw):/ " catches throw error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5758 let caught = caught + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5759 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5760 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5761 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5762 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5763 if caught != 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5764 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5765 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5766 elseif caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5767 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5768 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5769 return | " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5770 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5771 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5772 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5773
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5774 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5775 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5776
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5777 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5778 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5779 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5780 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5781 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5782 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5783 catch /^Vim/ " catch error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5784 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5785 " Trigger Vim error exception with value specified after :echoerr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5786 let value = substitute(v:exception, '^Vim\((.*)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5787 echoerr value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5788 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5789 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5790 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5791 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5792 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5793 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5794 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5795 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5796 let value = "Error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5797 echoerr value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5798 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5799 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5800 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5801 catch /^Vim(echoerr):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5802 let caught = caught + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5803 if v:exception !~ value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5804 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5805 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5806 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5807 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5808 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5809 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5810 if caught != 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5811 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5812 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5813 elseif caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5814 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5815 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5816 return | " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5817 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5818 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5819 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5820
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5821 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5822 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5823
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5824 unlet! value caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5826 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5827 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5828 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5829 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5830 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5831 let intcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5832 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5833 catch /^Vim:/ " catch interrupt exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5834 let intcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5835 " Trigger Vim error exception with value specified after :echoerr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5836 echoerr substitute(v:exception, '^Vim\((.*)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5837 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5838 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5839 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5840 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5841 if !intcaught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5842 if !$VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5843 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5844 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5845 echoerr "Interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5846 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5847 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5848 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5849 catch /^Vim(echoerr):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5850 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5851 if v:exception !~ "Interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5852 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5853 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5854 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5855 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5856 if !errcaught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5857 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5858 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5859 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5860 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5861
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5862 Xcheck 311511339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5863
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5865 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5866 " Test 61: Catching interrupt exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5867 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5868 " When an interrupt occurs inside a :try/:endtry region, an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5869 " interrupt exception is thrown and can be caught. Its value is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5870 " "Vim:Interrupt". If the interrupt occurs after an error or a :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5871 " but before a matching :catch is reached, all following :catches of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5872 " that try block are ignored, but the interrupt exception can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5873 " caught by the next surrounding try conditional. An interrupt is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5874 " ignored when there is a previous interrupt that has not been caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5875 " or causes a :finally clause to be executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5876 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5877
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5878 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5879
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5880 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5881
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5882 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5883 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5884 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5885 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5886 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5887 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5888 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5889 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5890 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5891 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5892 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5893 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5894 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5895 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5896 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5897 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5898 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5899 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5900 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5901 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5902 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5903 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5905 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5906 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5907 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5908 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5909 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5910 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5911 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5912 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5913 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5914 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5915 catch /.*/ "INTERRUPT - throw interrupt if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5916 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5917 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5918 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5919 finally "INTERRUPT - throw interrupt if $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5920 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5921 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5922 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5923 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5924 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5925 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5926 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5927 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5928 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5929 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5930 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5931 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5932 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5933 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5934 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5935 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5936 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5937
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5938 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5939 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5940 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5941 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5942 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5943 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5944 throw "x"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5945 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5946 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5947 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5948 catch /x/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5949 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5950 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5951 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5952 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5953 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5954 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5955 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5956 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5957 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5958 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5959 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5960 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5961 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5962 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5963 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5964 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5965 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5966 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5967 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5968
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5969 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5970 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5971 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5972 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5973 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5974 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5975 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5976 catch /do_not_catch/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5977 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5978 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5979 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5980 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5981 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5982 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5983 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5984 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5985 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5986 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5987 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5988 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5989 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5990 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5991 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5992 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5994 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5996 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5998 Xcheck 374889517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5999
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6000
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6001 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6002 " Test 62: Catching error exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6003 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6004 " An error inside a :try/:endtry region is converted to an exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6005 " and can be caught. The error exception has a "Vim(cmdname):" prefix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6006 " where cmdname is the name of the failing command, or a "Vim:" prefix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6007 " if no command name is known. The "Vim" prefixes cannot be faked.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6008 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6009
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6010 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6011
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6012 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6013 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6014 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6015 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6016 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6017 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6018 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6019 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6020 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6021 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6022 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6023 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6024 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6025 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6026 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6027 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6028 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6029 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6030
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6031 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6032 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6033 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6034 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6035 unlet novar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6036 catch /^Vim(unlet):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6037 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6038 let v:errmsg = substitute(v:exception, '^Vim(unlet):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6039 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6040 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6041 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6042 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6043 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6044 if !MSG('E108', "No such variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6045 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6046 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6047 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6048 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6049 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6050 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6051 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6052 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6053 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6054 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6055
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6056 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6057 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6058 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6059 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6060 throw novar " error in :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6061 catch /^Vim(throw):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6062 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6063 let v:errmsg = substitute(v:exception, '^Vim(throw):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6064 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6065 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6066 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6067 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6068 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6069 if caught ? !MSG('E121', "Undefined variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6070 \ : !MSG('E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6071 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6072 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6073 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6074 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6075 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6076 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6077 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6078 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6079 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6080 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6082 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6083 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6084 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6085 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6086 throw "Vim:faked" " error: cannot fake Vim exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6087 catch /^Vim(throw):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6088 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6089 let v:errmsg = substitute(v:exception, '^Vim(throw):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6090 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6091 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6092 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6093 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6094 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6095 if !MSG('E608', "Cannot :throw exceptions with 'Vim' prefix")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6096 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6097 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6098 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6099 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6100 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6101 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6102 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6103 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6104 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6105 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6107 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6108 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6109 " Missing :endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6110 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6112 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6113 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6114 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6115 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6116 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6117 catch /^Vim(endfunction):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6118 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6119 let v:errmsg = substitute(v:exception, '^Vim(endfunction):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6120 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6121 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6122 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6123 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6124 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6125 if !MSG('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6126 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6127 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6128 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6129 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6130 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6131 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6132 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6133 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6134 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6135 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6137 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6138 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6139 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6140 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6141 ExecAsScript F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6142 catch /^Vim:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6143 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6144 let v:errmsg = substitute(v:exception, '^Vim:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6145 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6146 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6147 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6148 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6149 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6150 if !MSG('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6151 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6152 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6153 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6154 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6155 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6156 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6157 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6158 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6159 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6160 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6162 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6163 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6164 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6166 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6167 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6168 let mfd_save = &mfd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6169 set mfd=3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6170 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6171 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6172 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6173 catch /^Vim(call):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6174 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6175 let v:errmsg = substitute(v:exception, '^Vim(call):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6176 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6177 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6178 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6179 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6180 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6181 if !MSG('E132', "Function call depth is higher than 'maxfuncdepth'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6182 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6183 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6184 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6185 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6186 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6187 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6188 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6189 let &mfd = mfd_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6190 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6191 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6192 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6194 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6195 return H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6196 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6198 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6199 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6200 let mfd_save = &mfd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6201 set mfd=3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6202 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6203 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6204 call H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6205 catch /^Vim(return):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6206 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6207 let v:errmsg = substitute(v:exception, '^Vim(return):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6208 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6209 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6210 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6211 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6212 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6213 if !MSG('E132', "Function call depth is higher than 'maxfuncdepth'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6214 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6215 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6216 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6217 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6218 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6219 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6220 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6221 let &mfd = mfd_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6222 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6223 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6224 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6226 unlet! caught mfd_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6227 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6228 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6229 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6230 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6232 Xcheck 286331153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6234 " Leave MSG() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6237 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6238 " Test 63: Suppressing error exceptions by :silent!. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6239 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6240 " A :silent! command inside a :try/:endtry region suppresses the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6241 " conversion of errors to an exception and the immediate abortion on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6242 " error. When the commands executed by the :silent! themselves open
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6243 " a new :try/:endtry region, conversion of errors to exception and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6244 " immediate abortion is switched on again - until the next :silent!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6245 " etc. The :silent! has the effect of setting v:errmsg to the error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6246 " message text (without displaying it) and continuing with the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6247 " script line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6248 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6249 " When a command triggering autocommands is executed by :silent!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6250 " inside a :try/:endtry, the autocommand execution is not suppressed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6251 " on error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6252 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6253 " This test reuses the function MSG() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6254 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6256 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6258 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6260 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6262 function! S(n) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6263 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6264 let g:taken = g:taken . "E" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6265 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6266 exec "asdf" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6268 " Check that ":silent!" continues:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6269 Xloop 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6271 " Check that ":silent!" sets "v:errmsg":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6272 if MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6273 Xloop 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6274 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6275 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6277 function! Foo()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6278 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6279 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6280 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6281 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6282 " This is not silent:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6283 call S(3) " X: 0 * 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6284 catch /^Vim:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6285 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6286 let errmsg3 = substitute(v:exception, '^Vim:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6287 silent! call S(4) " X: 3 * 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6288 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6289 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6290 let errmsg3 = v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6291 " Do call S(4) here if not executed in :catch.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6292 silent! call S(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6293 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6294 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6295 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6296 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6297 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6298 let v:errmsg = errmsg3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6299 if !MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6300 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6301 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6302 silent! call S(5) " X: 3 * 256
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6303 " Break out of try conditionals that cover ":silent!". This also
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6304 " discards the aborting error when $VIMNOERRTHROW is non-zero.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6305 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6306 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6307 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6308 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6309 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6310 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6311 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6312 " This is a double ":silent!" (see caller).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6313 silent! call S(6) " X: 3 * 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6314 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6316 function! Bar()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6317 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6318 silent! call S(2) " X: 3 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6319 " X: 3 * 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6320 silent! execute "call Foo() | call S(7)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6321 silent! call S(8) " X: 3 * 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6322 endtry " normal end of try cond that covers ":silent!"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6323 " This has a ":silent!" from the caller:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6324 call S(9) " X: 3 * 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6325 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6327 silent! call S(1) " X: 3 * 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6328 silent! call Bar()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6329 silent! call S(10) " X: 3 * 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6330
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6331 let expected = "E1E2E3E4E5E6E7E8E9E10"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6332 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6333 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6334 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6335 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6336
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6337 augroup TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6338 autocmd BufWritePost * Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6339 augroup END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6340
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6341 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6342 write /i/m/p/o/s/s/i/b/l/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6343 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6345 autocmd! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6346 unlet! caught errmsg3 taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6347 delfunction S
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6348 delfunction Foo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6349 delfunction Bar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6350 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6352 Xcheck 236978127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6355 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6356 " Test 64: Error exceptions after error, interrupt or :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6357 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6358 " When an error occurs after an interrupt or a :throw but before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6359 " a matching :catch is reached, all following :catches of that try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6360 " block are ignored, but the error exception can be caught by the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6361 " surrounding try conditional. Any previous error exception is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6362 " discarded. An error is ignored when there is a previous error that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6363 " has not been caught.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6364 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6366 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6368 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6370 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6371 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6372 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6373 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6374 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6375 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6376 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6377 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6378 endwhile " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6379 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6380 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6381 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6382 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6383 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6384 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6385 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6386 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6387 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6388 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6389 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6390 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6391 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6392 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6393 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6395 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6396 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6397 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6398 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6399 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6400 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6401 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6402 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6403 catch /.*/ " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6404 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6405 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6406 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6407 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6408 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6409 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6410 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6411 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6412 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6413 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6414 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6415 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6416 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6417 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6418 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6419 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6420 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6421 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6422 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6424 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6425 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6426 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6427 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6428 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6429 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6430 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6431 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6432 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6433 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6434 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6435 catch /.*/ " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6436 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6437 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6438 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6439 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6440 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6441 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6442 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6443 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6444 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6445 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6446 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6447 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6448 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6449 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6450 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6451 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6452 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6453 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6454 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6456 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6457 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6458 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6459 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6460 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6461 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6462 throw "x"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6463 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6464 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6465 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6466 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6467 catch /x/ " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6468 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6469 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6470 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6471 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6472 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6473 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6474 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6475 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6476 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6477 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6478 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6479 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6480 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6481 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6482 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6483 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6484 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6485 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6486 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6488 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6489 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6490 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6491 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6492 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6493 " endif " :endif without :if; throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6494 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6495 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6496 catch /do_not_catch/ " ignore new error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6497 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6498 catch /^Vim(endif):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6499 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6500 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6501 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6502 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6503 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6504 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6505 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6506 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6507 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6508 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6509 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6510 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6511 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6512 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6513 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6514 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6516 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6518 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6519
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6520 Xcheck 1499645335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6521
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6523 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6524 " Test 65: Errors in the /pattern/ argument of a :catch {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6525 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6526 " On an error in the /pattern/ argument of a :catch, the :catch does
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6527 " not match. Any following :catches of the same :try/:endtry don't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6528 " match either. Finally clauses are executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6529 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6530
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6531 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6532
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6533 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6534 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6535 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6536 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6537 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6538 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6539 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6540 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6541 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6542 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6543 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6544 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6545 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6546 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6547 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6548 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6549 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6550 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6552 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6553 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6554 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6555 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6556 catch /^oops$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6557 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6558 catch /\)/ " not checked; exception has already been caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6559 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6560 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6561 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6562 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6563 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6564 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6565 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6567 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6568 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6569 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6570 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6571 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6572 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6573 throw "ab"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6574 catch /abc/ " does not catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6575 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6576 catch /\)/ " error; discards exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6577 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6578 catch /.*/ " not checked
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6579 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6580 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6581 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6582 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6583 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6584 catch /^ab$/ " checked, but original exception is discarded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6585 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6586 catch /^Vim(catch):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6587 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6588 let v:errmsg = substitute(v:exception, '^Vim(catch):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6589 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6590 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6591 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6592 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6593 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6594 if caught ? !MSG('E55', 'Unmatched \\)')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6595 \ : !MSG('E475', "Invalid argument")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6596 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6597 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6598 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6599 return | " discard error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6600 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6601 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6602 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6603 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6604 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6605 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6606 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6607
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6608 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6609 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6610
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6611 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6612 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6613 unlet! caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6615 Xcheck 70187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6616
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6617
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6618 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6619 " Test 66: Stop range :call on error, interrupt, or :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6620 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6621 " When a function which is multiply called for a range since it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6622 " doesn't handle the range itself has an error in a command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6623 " dynamically enclosed by :try/:endtry or gets an interrupt or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6624 " executes a :throw, no more calls for the remaining lines in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6625 " range are made. On an error in a command not dynamically enclosed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6626 " by :try/:endtry, the function is executed again for the remaining
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6627 " lines in the range.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6628 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6629
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6630 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6632 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6633
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6634 let file = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6635 exec "edit" file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6637 insert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6638 line 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6639 line 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6640 line 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6641 .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6643 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6644
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6645 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6646 let expected = "G1EF1E(1)F1E(2)F1E(3)G2EF2E(1)G3IF3I(1)G4TF4T(1)G5AF5A(1)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6648 function! F(reason, n) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6649 let g:taken = g:taken . "F" . a:n .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6650 \ substitute(a:reason, '\(\l\).*', '\u\1', "") .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6651 \ "(" . line(".") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6653 if a:reason == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6654 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6655 elseif a:reason == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6656 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6657 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6658 elseif a:reason == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6659 throw "xyz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6660 elseif a:reason == "aborting error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6661 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6662 if g:taken != g:expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6663 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6664 Xout "'taken' is" g:taken "instead of" g:expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6665 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6666 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6667 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6668 call delete(file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6669 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6670 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6671 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6672 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6674 function! G(reason, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6675 let g:taken = g:taken . "G" . a:n .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6676 \ substitute(a:reason, '\(\l\).*', '\u\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6677 1,3call F(a:reason, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6678 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6679
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6680 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6681 call G("error", 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6682 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6683 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6684 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6685 call G("error", 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6686 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6687 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6688 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6689 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6690 call G("interrupt", 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6691 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6692 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6693 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6694 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6695 call G("throw", 4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6696 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6697 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6698 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6699 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6700 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6701 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6702 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6703 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6704 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6705 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6706 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6707 call G("aborting error", 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6708 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6709 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6711 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6712
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6713 Xcheck 5464
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6714
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6716 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6717 " Test 67: :throw across :call command {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6718 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6719 " On a call command, an exception might be thrown when evaluating the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6720 " function name, during evaluation of the arguments, or when the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6721 " function is being executed. The exception can be caught by the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6722 " caller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6723 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6724
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6725 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6726
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6727 function! THROW(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6728 if a:n == 1
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6729 Xpath 1 " X: 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6730 elseif a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6731 Xpath 2 " X: 2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6732 elseif a:n == 3
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6733 Xpath 4 " X: 4
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6734 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6735 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6736 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6737
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6738 function! NAME(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6739 if a:n == 1
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6740 Xpath 8 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6741 elseif a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6742 Xpath 16 " X: 16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6743 elseif a:n == 3
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6744 Xpath 32 " X: 32
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6745 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6746 Xpath 64 " X: 64
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6747 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6748 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6749 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6750
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6751 function! ARG(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6752 if a:n == 1
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6753 Xpath 128 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6754 elseif a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6755 Xpath 256 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6756 elseif a:n == 3
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6757 Xpath 512 " X: 512
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6758 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6759 Xpath 1024 " X: 1024
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6760 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6761 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6762 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6763
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6764 function! F(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6765 if a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6766 Xpath 2048 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6767 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6768 Xpath 4096 " X: 4096
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6769 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6770 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6771
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6772 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6773 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6774 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6775 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6776
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6777 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6778 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6779 Xpath 8192 " X: 8192
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6780 call {NAME(THROW("name", 1), 1)}(ARG(4711, 1), 1)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6781 Xpath 16384 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6782 catch /^name$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6783 Xpath 32768 " X: 32768
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6784 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6785 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6786 Xout "1:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6787 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6788 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6789 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6790 Xout "1:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6791 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6792 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6793 Xpath 65536 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6794 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6795 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6796 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6797 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6798 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6799 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6800
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6801 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6802 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6803 Xpath 131072 " X: 131072
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6804 call {NAME("F", 2)}(ARG(THROW("arg", 2), 2), 2)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6805 Xpath 262144 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6806 catch /^arg$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6807 Xpath 524288 " X: 524288
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6808 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6809 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6810 Xout "2:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6811 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6812 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6813 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6814 Xout "2:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6815 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6816 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6817 Xpath 1048576 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6818 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6819 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6820 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6821 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6822 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6823 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6824
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6825 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6826 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6827 Xpath 2097152 " X: 2097152
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6828 call {NAME("THROW", 3)}(ARG("call", 3), 3)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6829 Xpath 4194304 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6830 catch /^call$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6831 Xpath 8388608 " X: 8388608
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6832 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6833 Xpath 16777216 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6834 Xout "3:" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6835 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6836 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6837 Xout "3:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6838 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6839 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6840 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6841 Xout "3:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6842 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6843 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6844 Xpath 33554432 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6845 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6846 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6847 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6848 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6849 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6850 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6851
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6852 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6853 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6854 Xpath 67108864 " X: 67108864
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6855 call {NAME("F", 4)}(ARG(4711, 4), 4)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6856 Xpath 134217728 " X: 134217728
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6857 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6858 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6859 Xout "4:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6860 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6861 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6862 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6863 Xout "4:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6864 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6865 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6866 Xpath 268435456 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6867 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6868 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6869 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6870 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6871 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6872 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6873
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6874 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6875 Xpath 536870912 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6876 Xout v:throwpoint
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6877 catch /.*/
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6878 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6879 Xout v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6880 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6881 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6882 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6883 Xout v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6884 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6885 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6886 Xpath 1073741824 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6887 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6888 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6889 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6890 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6891
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6892 unlet error
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6893 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6894
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6895 Xcheck 212514423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6897 " Leave THROW(), NAME(), and ARG() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6898
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6899
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6900 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6901 " Test 68: :throw across function calls in expressions {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6902 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6903 " On a function call within an expression, an exception might be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6904 " thrown when evaluating the function name, during evaluation of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6905 " arguments, or when the function is being executed. The exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6906 " can be caught by the caller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6907 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6908 " This test reuses the functions THROW(), NAME(), and ARG() from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6909 " previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6910 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6911
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6912 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6914 function! F(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6915 if a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6916 Xpath 2048 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6917 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6918 Xpath 4096 " X: 4096
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6919 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6920 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6921 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6923 unlet! var1 var2 var3 var4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6924
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6925 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6926 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6927 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6928 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6929
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6930 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6931 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6932 Xpath 8192 " X: 8192
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6933 let var1 = {NAME(THROW("name", 1), 1)}(ARG(4711, 1), 1)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6934 Xpath 16384 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6935 catch /^name$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6936 Xpath 32768 " X: 32768
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6937 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6938 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6939 Xout "1:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6940 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6941 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6942 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6943 Xout "1:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6944 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6945 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6946 Xpath 65536 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6947 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6948 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6949 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6950 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6951 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6952 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6953
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6954 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6955 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6956 Xpath 131072 " X: 131072
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6957 let var2 = {NAME("F", 2)}(ARG(THROW("arg", 2), 2), 2)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6958 Xpath 262144 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6959 catch /^arg$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6960 Xpath 524288 " X: 524288
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6961 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6962 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6963 Xout "2:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6964 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6965 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6966 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6967 Xout "2:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6968 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6969 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6970 Xpath 1048576 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6971 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6972 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6973 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6974 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6975 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6976 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6977
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6978 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6979 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6980 Xpath 2097152 " X: 2097152
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6981 let var3 = {NAME("THROW", 3)}(ARG("call", 3), 3)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6982 Xpath 4194304 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6983 catch /^call$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6984 Xpath 8388608 " X: 8388608
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6985 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6986 Xpath 16777216 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6987 Xout "3:" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6988 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6989 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6990 Xout "3:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6991 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6992 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6993 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6994 Xout "3:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6995 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6996 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6997 Xpath 33554432 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6998 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6999 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7000 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7001 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7002 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7003 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7004
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7005 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7006 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7007 Xpath 67108864 " X: 67108864
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7008 let var4 = {NAME("F", 4)}(ARG(4711, 4), 4)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7009 Xpath 134217728 " X: 134217728
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7010 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7011 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7012 Xout "4:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7013 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7014 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7015 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7016 Xout "4:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7017 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7018 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7019 Xpath 268435456 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7020 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7021 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7022 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7023 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7024 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7025 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7026
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7027 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7028 Xpath 536870912 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7029 Xout v:throwpoint
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7030 catch /.*/
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7031 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7032 Xout v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7033 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7034 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7035 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7036 Xout v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7037 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7038 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7039 Xpath 1073741824 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7040 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7041 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7042 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7043 endwhile
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7044
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7045 if exists("var1") || exists("var2") || exists("var3") ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7046 \ !exists("var4") || var4 != 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7047 " The Xpath command does not accept 2^31 (negative); add explicitly:
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7048 let Xpath = Xpath + 2147483648 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7049 if exists("var1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7050 Xout "var1 =" var1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7051 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7052 if exists("var2")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7053 Xout "var2 =" var2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7054 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7055 if exists("var3")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7056 Xout "var3 =" var3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7057 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7058 if !exists("var4")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7059 Xout "var4 unset"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7060 elseif var4 != 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7061 Xout "var4 =" var4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7062 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7063 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7064
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7065 unlet! error var1 var2 var3 var4
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7066 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7067 delfunction NAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7068 delfunction ARG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7069 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7070
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7071 Xcheck 212514423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7073
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7074 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7075 " Test 69: :throw across :if, :elseif, :while {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7076 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7077 " On an :if, :elseif, or :while command, an exception might be thrown
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7078 " during evaluation of the expression to test. The exception can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7079 " caught by the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7080 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7082 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7083
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7084 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7086 function! THROW(x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7087 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7088 Xloop 1 " X: 1 + 2 + 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7089 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7090 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7091
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7092 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7094 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7095 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7096 if 4711 == THROW("if") + 111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7097 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7098 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7099 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7100 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7101 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7102 catch /^if$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7103 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7104 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7105 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7106 Xout "if:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7107 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7109 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7110 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7111 if 4711 == 4 + 7 + 1 + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7112 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7113 elseif 4711 == THROW("elseif") + 222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7114 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7115 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7116 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7117 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7118 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7119 catch /^elseif$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7120 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7121 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7122 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7123 Xout "elseif:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7124 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7126 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7127 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7128 while 4711 == THROW("while") + 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7129 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7130 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7131 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7132 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7133 catch /^while$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7134 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7135 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7136 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7137 Xout "while:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7138 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7140 catch /^0$/ " default return value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7141 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7142 Xout v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7143 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7144 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7145 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7146 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7148 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7150 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7151
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7152 Xcheck 8995471
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7155 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7156 " Test 70: :throw across :return or :throw {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7157 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7158 " On a :return or :throw command, an exception might be thrown during
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7159 " evaluation of the expression to return or throw, respectively. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7160 " exception can be caught by the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7161 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7163 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7165 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7166
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7167 function! THROW(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7168 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7169 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7170 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7172 function! F(x, y, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7173 let g:taken = g:taken . "F" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7174 return a:x + THROW(a:y, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7175 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7177 function! G(x, y, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7178 let g:taken = g:taken . "G" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7179 throw a:x . THROW(a:y, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7180 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7181 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7183 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7184 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7185 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7186 call F(4711, "return", 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7187 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7188 catch /^return$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7189 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7190 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7191 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7192 Xout "return:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7193 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7195 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7196 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7197 let var = F(4712, "return-var", 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7198 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7199 catch /^return-var$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7200 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7201 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7202 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7203 Xout "return-var:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7204 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7205 unlet! var
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7206 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7208 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7209 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7210 throw "except1" . THROW("throw1", 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7211 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7212 catch /^except1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7213 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7214 catch /^throw1$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7215 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7216 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7217 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7218 Xout "throw1:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7219 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7221 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7222 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7223 call G("except2", "throw2", 4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7224 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7225 catch /^except2/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7226 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7227 catch /^throw2$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7228 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7229 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7230 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7231 Xout "throw2:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7232 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7234 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7235 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7236 let var = G("except3", "throw3", 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7237 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7238 catch /^except3/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7239 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7240 catch /^throw3$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7241 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7242 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7243 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7244 Xout "throw3:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7245 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7246 unlet! var
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7247 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7249 let expected = "F1T1F2T2T3G4T4G5T5"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7250 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7251 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7252 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7253 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7255 catch /^0$/ " default return value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7256 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7257 Xout v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7258 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7259 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7260 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7261 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7263 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7265 unlet taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7266 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7267 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7268 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7270 Xcheck 69544277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7273 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7274 " Test 71: :throw across :echo variants and :execute {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7275 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7276 " On an :echo, :echon, :echomsg, :echoerr, or :execute command, an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7277 " exception might be thrown during evaluation of the arguments to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7278 " be displayed or executed as a command, respectively. Any following
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7279 " arguments are not evaluated, then. The exception can be caught by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7280 " the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7281 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7283 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7285 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7286
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7287 function! THROW(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7288 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7289 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7290 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7292 function! F(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7293 let g:taken = g:taken . "F" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7294 return "F" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7295 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7297 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7298 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7299 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7300 echo "echo" . THROW("echo-except", 1) F(1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7301 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7302 catch /^echo-except$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7303 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7304 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7305 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7306 Xout "echo:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7307 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7309 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7310 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7311 echon "echon" . THROW("echon-except", 2) F(2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7312 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7313 catch /^echon-except$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7314 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7315 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7316 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7317 Xout "echon:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7318 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7320 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7321 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7322 echomsg "echomsg" . THROW("echomsg-except", 3) F(3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7323 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7324 catch /^echomsg-except$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7325 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7326 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7327 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7328 Xout "echomsg:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7329 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7330
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7331 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7332 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7333 echoerr "echoerr" . THROW("echoerr-except", 4) F(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7334 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7335 catch /^echoerr-except$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7336 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7337 catch /Vim/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7338 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7339 catch /echoerr/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7340 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7341 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7342 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7343 Xout "echoerr:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7344 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7345
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7346 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7347 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7348 execute "echo 'execute" . THROW("execute-except", 5) F(5) "'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7349 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7350 catch /^execute-except$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7351 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7352 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7353 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7354 Xout "execute:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7355 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7357 let expected = "T1T2T3T4T5"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7358 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7359 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7360 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7361 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7363 catch /^0$/ " default return value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7364 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7365 Xout v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7366 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7367 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7368 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7369 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7371 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7372
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7373 unlet taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7374 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7375 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7377 Xcheck 34886997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7380 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7381 " Test 72: :throw across :let or :unlet {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7382 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7383 " On a :let command, an exception might be thrown during evaluation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7384 " of the expression to assign. On an :let or :unlet command, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7385 " evaluation of the name of the variable to be assigned or list or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7386 " deleted, respectively, may throw an exception. Any following
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7387 " arguments are not evaluated, then. The exception can be caught by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7388 " the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7389 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7390
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7391 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7393 let throwcount = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7395 function! THROW(x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7396 let g:throwcount = g:throwcount + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7397 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7398 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7400 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7401 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7402 let $VAR = "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7403 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7404 let $VAR = "let(" . THROW("var") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7405 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7406 catch /^var$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7407 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7408 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7409 if $VAR != "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7410 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7411 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7412 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7414 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7415 let @a = "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7416 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7417 let @a = "let(" . THROW("reg") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7418 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7419 catch /^reg$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7420 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7421 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7422 let @A = "let(" . THROW("REG") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7423 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7424 catch /^REG$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7425 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7426 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7427 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7428 if @a != "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7429 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7430 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7431 if @A != "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7432 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7433 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7434 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7435
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7436 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7437 let saved_gpath = &g:path
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7438 let saved_lpath = &l:path
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7439 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7440 let &path = "let(" . THROW("opt") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7441 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7442 catch /^opt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7443 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7444 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7445 let &g:path = "let(" . THROW("gopt") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7446 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7447 catch /^gopt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7448 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7449 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7450 let &l:path = "let(" . THROW("lopt") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7451 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7452 catch /^lopt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7453 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7454 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7455 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7456 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7457 if &g:path != saved_gpath || &l:path != saved_lpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7458 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7459 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7460 let &g:path = saved_gpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7461 let &l:path = saved_lpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7462 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7464 unlet! var1 var2 var3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7466 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7467 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7468 let var1 = "let(" . THROW("var1") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7469 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7470 catch /^var1$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7471 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7472 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7473 if exists("var1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7474 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7475 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7476 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7477
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7478 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7479 let var2 = "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7480 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7481 let var2 = "let(" . THROW("var2"). ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7482 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7483 catch /^var2$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7484 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7485 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7486 if var2 != "old_value"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7487 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7488 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7489 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7490
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7491 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7492 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7493 let var{THROW("var3")} = 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7494 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7495 catch /^var3$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7496 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7497 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7499 let addpath = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7500
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7501 function ADDPATH(p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7502 let g:addpath = g:addpath . a:p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7503 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7504
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7505 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7506 call ADDPATH("T1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7507 let var{THROW("var4")} var{ADDPATH("T2")} | call ADDPATH("T3")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7508 call ADDPATH("T4")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7509 catch /^var4$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7510 call ADDPATH("T5")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7511 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7513 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7514 call ADDPATH("T6")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7515 unlet var{THROW("var5")} var{ADDPATH("T7")} | call ADDPATH("T8")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7516 call ADDPATH("T9")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7517 catch /^var5$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7518 call ADDPATH("T10")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7519 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7521 if addpath != "T1T5T6T10" || throwcount != 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7522 throw "addpath: " . addpath . ", throwcount: " . throwcount
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7523 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7524
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7525 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7526
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7527 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7528 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7529 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7530 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7531 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7532
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7533 unlet! var1 var2 var3 addpath throwcount
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7534 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7535
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7536 Xcheck 1789569365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7537
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7538
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7539 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7540 " Test 73: :throw across :function, :delfunction {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7541 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7542 " The :function and :delfunction commands may cause an expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7543 " specified in braces to be evaluated. During evaluation, an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7544 " exception might be thrown. The exception can be caught by the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7545 " script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7546 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7547
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7548 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7550 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7552 function! THROW(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7553 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7554 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7555 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7557 function! EXPR(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7558 let g:taken = g:taken . "E" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7559 if a:n % 2 == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7560 call THROW(a:x, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7561 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7562 return 2 - a:n % 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7563 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7564
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7565 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7566 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7567 " Define function.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7568 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7569 function! F0()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7570 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7571 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7572 function! F{EXPR("function-def-ok", 1)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7573 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7574 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7575 function! F{EXPR("function-def", 2)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7576 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7577 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7578 catch /^function-def-ok$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7579 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7580 catch /^function-def$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7581 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7582 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7583 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7584 Xout "def:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7585 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7586
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7587 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7588 " List function.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7589 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7590 function F0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7591 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7592 function F{EXPR("function-lst-ok", 3)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7593 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7594 function F{EXPR("function-lst", 4)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7595 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7596 catch /^function-lst-ok$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7597 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7598 catch /^function-lst$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7599 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7600 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7601 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7602 Xout "lst:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7603 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7605 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7606 " Delete function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7607 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7608 delfunction F0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7609 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7610 delfunction F{EXPR("function-del-ok", 5)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7611 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7612 delfunction F{EXPR("function-del", 6)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7613 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7614 catch /^function-del-ok$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7615 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7616 catch /^function-del$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7617 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7618 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7619 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7620 Xout "del:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7621 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7623 let expected = "E1E2T2E3E4T4E5E6T6"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7624 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7625 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7626 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7627 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7628
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7629 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7630 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7631 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7632 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7633
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7634 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7636 unlet taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7637 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7638 delfunction EXPR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7640 Xcheck 9032615
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7641
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7643 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
7644 " Test 74: :throw across builtin functions and commands {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7645 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7646 " Some functions like exists(), searchpair() take expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7647 " arguments, other functions or commands like substitute() or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7648 " :substitute cause an expression (specified in the regular
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7649 " expression) to be evaluated. During evaluation an exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7650 " might be thrown. The exception can be caught by the script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7651 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7653 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7654
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7655 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7657 function! THROW(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7658 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7659 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7660 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7661
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7662 function! EXPR(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7663 let g:taken = g:taken . "E" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7664 call THROW(a:x . a:n, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7665 return "EXPR"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7666 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7667
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7668 function! SKIP(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7669 let g:taken = g:taken . "S" . a:n . "(" . line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7670 let theline = getline(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7671 if theline =~ "skip"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7672 let g:taken = g:taken . "s)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7673 return 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7674 elseif theline =~ "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7675 let g:taken = g:taken . "t)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7676 call THROW(a:x . a:n, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7677 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7678 let g:taken = g:taken . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7679 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7680 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7681 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7682
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7683 function! SUBST(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7684 let g:taken = g:taken . "U" . a:n . "(" . line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7685 let theline = getline(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7686 if theline =~ "not" " SUBST() should not be called for this line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7687 let g:taken = g:taken . "n)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7688 call THROW(a:x . a:n, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7689 elseif theline =~ "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7690 let g:taken = g:taken . "t)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7691 call THROW(a:x . a:n, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7692 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7693 let g:taken = g:taken . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7694 return "replaced"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7695 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7696 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7697
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7698 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7699 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7700 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7701 let result = exists('*{EXPR("exists", 1)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7702 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7703 catch /^exists1$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7704 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7705 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7706 let result = exists('{EXPR("exists", 2)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7707 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7708 catch /^exists2$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7709 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7710 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7711 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7712 Xout "exists2:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7713 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7714 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7715 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7716 Xout "exists1:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7717 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7718
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7719 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7720 let file = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7721 exec "edit" file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7722 insert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7723 begin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7724 xx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7725 middle 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7726 xx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7727 middle 5 skip
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7728 xx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7729 middle 7 throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7730 xx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7731 end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7732 .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7733 normal! gg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7734 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7735 let result =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7736 \ searchpair("begin", "middle", "end", '', 'SKIP("searchpair", 3)')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7737 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7738 let result =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7739 \ searchpair("begin", "middle", "end", '', 'SKIP("searchpair", 4)')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7740 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7741 let result =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7742 \ searchpair("begin", "middle", "end", '', 'SKIP("searchpair", 5)')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7743 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7744 catch /^searchpair[35]$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7745 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7746 catch /^searchpair4$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7747 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7748 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7749 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7750 Xout "searchpair:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7751 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7752 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7753 call delete(file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7754 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7756 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7757 let file = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7758 exec "edit" file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7759 insert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7760 subst 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7761 subst 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7762 not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7763 subst 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7764 subst throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7765 subst 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7766 .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7767 normal! gg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7768 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7769 1,2substitute/subst/\=SUBST("substitute", 6)/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7770 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7771 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7772 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7773 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7774 3substitute/subst/\=SUBST("substitute", 7)/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7775 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7776 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7777 " If exceptions are not thrown on errors, fake the error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7778 " exception in order to get the same execution path.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7779 throw "faked Vim(substitute)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7780 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7781 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7782 catch /Vim(substitute)/ " Pattern not found ('e' flag missing)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7783 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7784 3substitute/subst/\=SUBST("substitute", 8)/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7785 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7786 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7787 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7788 4,6substitute/subst/\=SUBST("substitute", 9)/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7789 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7790 catch /^substitute[678]/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7791 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7792 catch /^substitute9/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7793 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7794 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7795 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7796 call delete(file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7797 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7798
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7799 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7800 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7801 let var = substitute("sub", "sub", '\=THROW("substitute()y", 10)', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7802 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7803 catch /substitute()y/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7804 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7805 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7806 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7807 Xout "substitute()y:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7808 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7809
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7810 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7811 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7812 let var = substitute("not", "sub", '\=THROW("substitute()n", 11)', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7813 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7814 catch /substitute()n/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7815 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7816 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7817 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7818 Xout "substitute()n:" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7819 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7820
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7821 let expected = "E1T1E2T2S3(3)S4(5s)S4(7t)T4U6(1)U6(2)U9(4)U9(5t)T9T10"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7822 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7823 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7824 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7825 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7826
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7827 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7828 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7829 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7830 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7831 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7832
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7833 unlet result var taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7834 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7835 delfunction EXPR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7836 delfunction SKIP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7837 delfunction SUBST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7838
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7839 Xcheck 224907669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7840
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7841
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7842 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7843 " Test 75: Errors in builtin functions. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7844 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7845 " On an error in a builtin function called inside a :try/:endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7846 " region, the evaluation of the expression calling that function and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7847 " the command containing that expression are abandoned. The error can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7848 " be caught as an exception.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7849 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7850 " A simple :call of the builtin function is a trivial case. If the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7851 " builtin function is called in the argument list of another function,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7852 " no further arguments are evaluated, and the other function is not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7853 " executed. If the builtin function is called from the argument of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7854 " a :return command, the :return command is not executed. If the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7855 " builtin function is called from the argument of a :throw command,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7856 " the :throw command is not executed. The evaluation of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7857 " expression calling the builtin function is abandoned.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7858 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7860 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7861
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7862 function! F1(arg1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7863 Xpath 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7864 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7865
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7866 function! F2(arg1, arg2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7867 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7868 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7869
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7870 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7871 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7872 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7873
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7874 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7875 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7876 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7877
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7878 function! R()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7879 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7880 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7881 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7882 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7883 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7884 return append(1, "s")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7885 catch /E21/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7886 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7887 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7888 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7889 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7890 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7891 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7892 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7893 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7894 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7895 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7896 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7897 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7898 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7899
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7900 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7901 set noma " let append() fail with "E21"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7902
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7903 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7904 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7905 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7906 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7907 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7908 call append(1, "s")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7909 catch /E21/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7910 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7911 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7912 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7913 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7914 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7915 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7916 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7917 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7918 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7919 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7920 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7921
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7922 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7923 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7924 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7925 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7926 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7927 call F1('x' . append(1, "s"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7928 catch /E21/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7929 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7930 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7931 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7932 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7933 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7934 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7935 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7936 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7937 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7938 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7939 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7940
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7941 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7942 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7943 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7944 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7945 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7946 call F2('x' . append(1, "s"), G())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7947 catch /E21/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7948 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7949 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7950 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7951 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7952 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7953 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7954 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7955 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7956 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7957 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7958 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7959
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7960 call R()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7961
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7962 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7963 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7964 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7965 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7966 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7967 throw "T" . append(1, "s")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7968 catch /E21/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7969 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7970 catch /^T.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7971 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7972 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7973 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7974 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7975 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7976 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7977 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7978 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7979 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7980 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7981 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7982
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7983 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7984 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7985 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7986 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7987 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7988 let x = "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7989 let x = x . "b" . append(1, "s") . H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7990 catch /E21/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7991 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7992 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7993 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7994 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7995 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7996 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7997 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7998 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7999 if x == "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8000 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8001 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8002 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8003 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8004 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8005 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8006 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8007 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8008 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8009 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8010 set ma&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8011 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8012
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8013 unlet! caught x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8014 delfunction F1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8015 delfunction F2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8016 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8017 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8018 delfunction R
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8019
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8020 Xcheck 2000403408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8021
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8022
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8023 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
8024 " Test 76: Errors, interrupts, :throw during expression evaluation {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8025 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8026 " When a function call made during expression evaluation is aborted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8027 " due to an error inside a :try/:endtry region or due to an interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8028 " or a :throw, the expression evaluation is aborted as well. No
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8029 " message is displayed for the cancelled expression evaluation. On an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8030 " error not inside :try/:endtry, the expression evaluation continues.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8031 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8032
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8033 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8034
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8035 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8036
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8037 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8038
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8039 function! ERR(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8040 let g:taken = g:taken . "E" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8041 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8042 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8044 function! ERRabort(n) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8045 let g:taken = g:taken . "A" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8046 asdf
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8047 endfunction " returns -1; may cause follow-up msg for illegal var/func name
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8048
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8049 function! WRAP(n, arg)
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8050 let g:taken = g:taken . "W" . a:n
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8051 let g:saved_errmsg = v:errmsg
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8052 return arg
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8053 endfunction
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8054
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8055 function! INT(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8056 let g:taken = g:taken . "I" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8057 "INTERRUPT9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8058 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8059 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8060
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8061 function! THR(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8062 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8063 throw "should not be caught"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8064 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8065
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8066 function! CONT(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8067 let g:taken = g:taken . "C" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8068 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8070 function! MSG(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8071 let g:taken = g:taken . "M" . a:n
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8072 let errmsg = (a:n >= 37 && a:n <= 44) ? g:saved_errmsg : v:errmsg
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8073 let msgptn = (a:n >= 10 && a:n <= 27) ? "^$" : "asdf"
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8074 if errmsg !~ msgptn
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8075 let g:taken = g:taken . "x"
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8076 Xout "Expr" a:n.": Unexpected message:" v:errmsg
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8077 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8078 let v:errmsg = ""
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8079 let g:saved_errmsg = ""
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8080 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8082 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8083
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8084 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8085 let t = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8086 XloopINIT 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8087 while t <= 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8088 Xloop 1 " X: 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8089 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8090 if t == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8091 let v{ERR(t) + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8092 elseif t == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8093 let v{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8094 elseif t == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8095 let var = exists('v{ERR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8096 elseif t == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8097 unlet v{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8098 elseif t == 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8099 function F{ERR(t) + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8100 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8101 elseif t == 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8102 function F{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8103 elseif t == 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8104 let var = exists('*F{ERR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8105 elseif t == 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8106 delfunction F{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8107 elseif t == 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8108 let var = ERR(t) + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8109 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8110 catch /asdf/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8111 " v:errmsg is not set when the error message is converted to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8112 " exception. Set it to the original error message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8113 let v:errmsg = substitute(v:exception, '^Vim:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8114 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8115 " An error exception has been thrown after the original error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8116 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8117 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8118 call MSG(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8119 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8120 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8121 continue " discard an aborting error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8122 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8123 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8124 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8125 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8126 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8127 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8129 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8130 let t = 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8131 XloopINIT 1024 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8132 while t <= 18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8133 Xloop 1 " X: 1024 * 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8134 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8135 if t == 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8136 let v{INT(t) + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8137 elseif t == 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8138 let v{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8139 elseif t == 12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8140 let var = exists('v{INT(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8141 elseif t == 13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8142 unlet v{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8143 elseif t == 14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8144 function F{INT(t) + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8145 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8146 elseif t == 15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8147 function F{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8148 elseif t == 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8149 let var = exists('*F{INT(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8150 elseif t == 17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8151 delfunction F{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8152 elseif t == 18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8153 let var = INT(t) + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8154 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8155 catch /^Vim\((\a\+)\)\=:\(Interrupt\)\@!/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8156 " An error exception has been triggered after the interrupt.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8157 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8158 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8159 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8160 call MSG(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8161 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8162 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8163 continue " discard interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8164 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8165 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8166 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8167 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8168 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8169 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8171 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8172 let t = 19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8173 XloopINIT 1048576 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8174 while t <= 27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8175 Xloop 1 " X: 1048576 * 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8176 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8177 if t == 19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8178 let v{THR(t) + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8179 elseif t == 20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8180 let v{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8181 elseif t == 21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8182 let var = exists('v{THR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8183 elseif t == 22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8184 unlet v{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8185 elseif t == 23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8186 function F{THR(t) + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8187 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8188 elseif t == 24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8189 function F{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8190 elseif t == 25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8191 let var = exists('*F{THR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8192 elseif t == 26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8193 delfunction F{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8194 elseif t == 27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8195 let var = THR(t) + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8196 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8197 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8198 " An error exception has been triggered after the :throw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8199 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8200 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8201 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8202 call MSG(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8203 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8204 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8205 continue " discard exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8206 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8207 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8208 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8209 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8210 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8211 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8213 let v{ERR(28) + CONT(28)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8214 call MSG(28)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8215 let v{ERR(29) + CONT(29)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8216 call MSG(29)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8217 let var = exists('v{ERR(30) + CONT(30)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8218 call MSG(30)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8219 unlet v{ERR(31) + CONT(31)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8220 call MSG(31)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8221 function F{ERR(32) + CONT(32)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8222 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8223 call MSG(32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8224 function F{ERR(33) + CONT(33)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8225 call MSG(33)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8226 let var = exists('*F{ERR(34) + CONT(34)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8227 call MSG(34)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8228 delfunction F{ERR(35) + CONT(35)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8229 call MSG(35)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8230 let var = ERR(36) + CONT(36)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8231 call MSG(36)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8232
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8233 let saved_errmsg = ""
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8234
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8235 let v{WRAP(37, ERRabort(37)) + CONT(37)} = 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8236 call MSG(37)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8237 let v{WRAP(38, ERRabort(38)) + CONT(38)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8238 call MSG(38)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8239 let var = exists('v{WRAP(39, ERRabort(39)) + CONT(39)}')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8240 call MSG(39)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8241 unlet v{WRAP(40, ERRabort(40)) + CONT(40)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8242 call MSG(40)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8243 function F{WRAP(41, ERRabort(41)) + CONT(41)}()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8244 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8245 call MSG(41)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8246 function F{WRAP(42, ERRabort(42)) + CONT(42)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8247 call MSG(42)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8248 let var = exists('*F{WRAP(43, ERRabort(43)) + CONT(43)}')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8249 call MSG(43)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8250 delfunction F{WRAP(44, ERRabort(44)) + CONT(44)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8251 call MSG(44)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8252 let var = ERRabort(45) + CONT(45)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8253 call MSG(45)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8255 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8257 let expected = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8258 \ . "E1M1E2M2E3M3E4M4E5M5E6M6E7M7E8M8E9M9"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8259 \ . "I10M10I11M11I12M12I13M13I14M14I15M15I16M16I17M17I18M18"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8260 \ . "T19M19T20M20T21M21T22M22T23M23T24M24T25M25T26M26T27M27"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8261 \ . "E28C28M28E29C29M29E30C30M30E31C31M31E32C32M32E33C33M33"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8262 \ . "E34C34M34E35C35M35E36C36M36"
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8263 \ . "A37W37C37M37A38W38C38M38A39W39C39M39A40W40C40M40A41W41C41M41"
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8264 \ . "A42W42C42M42A43W43C43M43A44W44C44M44A45C45M45"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8266 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8267 " The Xpath command does not accept 2^31 (negative); display explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8268 exec "!echo 2147483648 >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8269 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8270 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8271 if substitute(taken,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8272 \ '\(.*\)E3C3M3x\(.*\)E30C30M30x\(.*\)A39C39M39x\(.*\)',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8273 \ '\1E3M3\2E30C30M30\3A39C39M39\4',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8274 \ "") == expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8275 Xout "Is ++emsg_skip for var with expr_start non-NULL"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8276 \ "in f_exists ok?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8277 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8278 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8279
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
8280 unlet! v var saved_errmsg taken expected
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8281 call delete(WA_t5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8282 call delete(WA_t14)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8283 call delete(WA_t23)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8284 unlet! WA_t5 WA_t14 WA_t23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8285 delfunction WA_t5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8286 delfunction WA_t14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8287 delfunction WA_t23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8289 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8291 Xcheck 1610087935
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8294 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
8295 " Test 77: Errors, interrupts, :throw in name{brace-expression} {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8296 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8297 " When a function call made during evaluation of an expression in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8298 " braces as part of a function name after ":function" is aborted due
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8299 " to an error inside a :try/:endtry region or due to an interrupt or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8300 " a :throw, the expression evaluation is aborted as well, and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8301 " function definition is ignored, skipping all commands to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8302 " ":endfunction". On an error not inside :try/:endtry, the expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8303 " evaluation continues and the function gets defined, and can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8304 " called and deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8305 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8307 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8309 XloopINIT 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8311 function! ERR() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8312 Xloop 1 " X: 1 + 4 + 16 + 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8313 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8314 endfunction " returns -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8316 function! OK()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8317 Xloop 2 " X: 2 * (1 + 4 + 16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8318 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8319 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8320 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8322 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8324 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8325 function! F{1 + ERR() + OK()}(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8326 " F0 should be defined.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8327 if exists("a:arg") && a:arg == "calling"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8328 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8329 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8330 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8331 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8332 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8333 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8334 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8335 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8336 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8337
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8338 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8339 call F{1 + ERR() + OK()}("calling")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8340 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8341 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8342 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8343 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8345 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8346 delfunction F{1 + ERR() + OK()}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8347 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8348 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8349 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8350 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8352 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8353 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8354 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8355 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8356 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8357 function! G{1 + ERR() + OK()}(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8358 " G0 should not be defined, and the function body should be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8359 " skipped.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8360 if exists("a:arg") && a:arg == "calling"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8361 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8362 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8363 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8364 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8365 " Use an unmatched ":finally" to check whether the body is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8366 " skipped when an error occurs in ERR(). This works whether or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8367 " not the exception is converted to an exception.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8368 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8369 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8370 Xout "Body of G{1 + ERR() + OK()}() not skipped"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8371 " Discard the aborting error or exception, and break the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8372 " while loop.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8373 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8374 " End the try conditional and start a new one to avoid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8375 " ":catch after :finally" errors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8376 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8377 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8378 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8379 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8380
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8381 " When the function was not defined, this won't be reached - whether
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8382 " the body was skipped or not. When the function was defined, it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8383 " can be called and deleted here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8384 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8385 Xout "G0() has been defined"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8386 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8387 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8388 call G{1 + ERR() + OK()}("calling")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8389 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8390 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8391 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8392 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8393 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8394 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8395 delfunction G{1 + ERR() + OK()}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8396 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8397 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8398 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8399 catch /asdf/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8400 " Jumped to when the function is not defined and the body is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8401 " skipped.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8402 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8403 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8404 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8405 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8406 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8407 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8408 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8409 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8410 endtry " jumped to when the body is not skipped
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8411 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8412 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8413 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8414 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8415 Xout "Body of G{1 + ERR() + OK()}() not skipped, exception caught"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8416 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8417 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8418
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8419 Xcheck 1388671
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8420
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8421
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8422 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8423 " Test 78: Messages on parsing errors in expression evaluation {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8424 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8425 " When an expression evaluation detects a parsing error, an error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8426 " message is given and converted to an exception, and the expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8427 " evaluation is aborted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8428 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8429
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8430 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8432 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8433
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8434 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8435
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8436 function! F(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8437 let g:taken = g:taken . "F" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8438 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8440 function! MSG(n, enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8441 let g:taken = g:taken . "M" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8442 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8443 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8444 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8445 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8446 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8447 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8448 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8449 Xout "Expr" a:n.": Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8450 let g:taken = g:taken . "x"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8451 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8452 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8453 Xout "Expr" a:n.": Unexpected message:" v:errmsg
119
e8f07016e34d updated for version 7.0042
vimboss
parents: 108
diff changeset
8454 Xout "Expected: " . a:enr . ': ' . a:emsg
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8455 let g:taken = g:taken . "X"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8456 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8457 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8458 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8460 function! CONT(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8461 let g:taken = g:taken . "C" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8462 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8464 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8465 XloopINIT 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8467 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8468 let t = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8469 while t <= 14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8470 let g:taken = g:taken . "T" . t
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8471 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8472 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8473 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8474 if t == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8475 let v{novar + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8476 elseif t == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8477 let v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8478 elseif t == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8479 let var = exists('v{novar + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8480 elseif t == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8481 unlet v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8482 elseif t == 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8483 function F{novar + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8484 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8485 elseif t == 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8486 function F{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8487 elseif t == 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8488 let var = exists('*F{novar + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8489 elseif t == 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8490 delfunction F{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8491 elseif t == 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8492 echo novar + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8493 elseif t == 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8494 echo v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8495 elseif t == 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8496 echo F{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8497 elseif t == 12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8498 let var = novar + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8499 elseif t == 13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8500 let var = v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8501 elseif t == 14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8502 let var = F{novar + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8503 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8504 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8505 " v:errmsg is not set when the error message is converted to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8506 " exception. Set it to the original error message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8507 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8508 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8509 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8510 finally
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
8511 if t <= 8 && t != 3 && t != 7
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
8512 call MSG(t, 'E475', 'Invalid argument\>')
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
8513 else
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
8514 if !caught " no error exceptions ($VIMNOERRTHROW set)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8515 call MSG(t, 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8516 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8517 call MSG(t, 'E121', "Undefined variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8518 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8519 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8520 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8521 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8522 continue " discard an aborting error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8523 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8524 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8525 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8526 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8527 Xout t.":" v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8528 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8529
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8530 function! T(n, expr, enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8531 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8532 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8533 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8534 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8535 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8536 execute "let var = " . a:expr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8537 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8538 " v:errmsg is not set when the error message is converted to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8539 " exception. Set it to the original error message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8540 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8541 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8542 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8543 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8544 if !caught " no error exceptions ($VIMNOERRTHROW set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8545 call MSG(a:n, 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8546 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8547 call MSG(a:n, a:enr, a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8548 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8549 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8550 " Discard an aborting error:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8551 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8552 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8553 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8554 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8555 Xout a:n.":" v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8556 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8557 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8559 call T(15, 'Nofunc() + CONT(15)', 'E117', "Unknown function")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8560 call T(16, 'F(1 2 + CONT(16))', 'E116', "Invalid arguments")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8561 call T(17, 'F(1, 2) + CONT(17)', 'E118', "Too many arguments")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8562 call T(18, 'F() + CONT(18)', 'E119', "Not enough arguments")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8563 call T(19, '{(1} + CONT(19)', 'E110', "Missing ')'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8564 call T(20, '("abc"[1) + CONT(20)', 'E111', "Missing ']'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8565 call T(21, '(1 +) + CONT(21)', 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8566 call T(22, '1 2 + CONT(22)', 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8567 call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8568 call T(24, '("abc) + CONT(24)', 'E114', "Missing quote")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8569 call T(25, "('abc) + CONT(25)", 'E115', "Missing quote")
102
0aa0e89bfd5f updated for version 7.0039
vimboss
parents: 95
diff changeset
8570 call T(26, '& + CONT(26)', 'E112', "Option name missing")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8571 call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8572
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8573 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8575 let expected = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8576 \ . "T1M1T2M2T3M3T4M4T5M5T6M6T7M7T8M8T9M9T10M10T11M11T12M12T13M13T14M14"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8577 \ . "T15M15T16M16T17M17T18M18T19M19T20M20T21M21T22M22T23M23T24M24T25M25"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8578 \ . "T26M26T27M27"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8580 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8581 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8582 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8583 if substitute(taken, '\(.*\)T3M3x\(.*\)', '\1T3M3\2', "") == expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8584 Xout "Is ++emsg_skip for var with expr_start non-NULL"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8585 \ "in f_exists ok?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8586 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8587 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8588
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8589 unlet! var caught taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8590 call delete(WA_t5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8591 unlet! WA_t5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8592 delfunction WA_t5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8594 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8595
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8596 Xcheck 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8599 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8600 " Test 79: Throwing one of several errors for the same command {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8601 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8602 " When several errors appear in a row (for instance during expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8603 " evaluation), the first as the most specific one is used when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8604 " throwing an error exception. If, however, a syntax error is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8605 " detected afterwards, this one is used for the error exception.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8606 " On a syntax error, the next command is not executed, on a normal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8607 " error, however, it is (relevant only in a function without the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8608 " "abort" flag). v:errmsg is not set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8609 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8610 " If throwing error exceptions is configured off, v:errmsg is always
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8611 " set to the latest error message, that is, to the more general
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8612 " message or the syntax error, respectively.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8613 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8615 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8616
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8617 XloopINIT 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8618
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8619 function! NEXT(cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8620 exec a:cmd . " | Xloop 1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8621 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8623 call NEXT('echo novar') " X: 1 * 1 (checks nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8624 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8625 call NEXT('let novar #') " X: 0 * 2 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8626 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8627 call NEXT('unlet novar #') " X: 0 * 4 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8628 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8629 call NEXT('let {novar}') " X: 0 * 8 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8630 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8631 call NEXT('unlet{ novar}') " X: 0 * 16 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8632
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8633 function! EXEC(cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8634 exec a:cmd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8635 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8637 function! MATCH(expected, msg, enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8638 let msg = a:msg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8639 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8640 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8641 let msg = ":" . msg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8642 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8643 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8644 if msg !~ '^'.a:enr.':' || (english && msg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8645 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8646 if a:expected " no match although expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8647 if a:msg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8648 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8649 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8650 let msg = escape(msg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8651 Xout "Unexpected message:" msg
108
375b1d0f97b0 updated for version 7.0040
vimboss
parents: 102
diff changeset
8652 Xout "Expected:" a:enr . ": " . a:emsg
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8653 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8654 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8655 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8656 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8657 if !a:expected " match although not expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8658 let msg = escape(msg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8659 Xout "Unexpected message:" msg
108
375b1d0f97b0 updated for version 7.0040
vimboss
parents: 102
diff changeset
8660 Xout "Expected none."
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8661 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8662 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8663 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8664 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8665
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8666 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8667
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8668 while 1 " dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8669 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8670 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8671 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8672 let thrmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8673 call EXEC('echo novar') " normal error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8674 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8675 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8676 let thrmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8677 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8678 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8679 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8680 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8681 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8682 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8683 elseif !MATCH(1, thrmsg, 'E121', "Undefined variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8684 \ || v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8685 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8686 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8687 if !caught && !MATCH(1, v:errmsg, 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8688 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8689 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8690 break " discard error if $VIMNOERRTHROW == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8691 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8692 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8693
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8694 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8695 let cmd = "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8696 XloopINIT 1024 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8697 while cmd != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8698 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8699 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8700 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8701 let thrmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8702 call EXEC(cmd . ' novar #') " normal plus syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8703 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8704 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8705 let thrmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8706 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8707 Xloop 1 " X: 1024 * (1 + 32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8708 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8709 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8710 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8711 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8712 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8713 if cmd == "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8714 let match = MATCH(0, thrmsg, 'E106', "Unknown variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8715 elseif cmd == "unlet"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8716 let match = MATCH(0, thrmsg, 'E108', "No such variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8717 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8718 if match " normal error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8719 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8720 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8721 if !MATCH(1, thrmsg, 'E488', "Trailing characters")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8722 \|| v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8723 " syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8724 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8725 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8726 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8727 if !caught && !MATCH(1, v:errmsg, 'E488', "Trailing characters")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8728 " last error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8729 Xloop 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8730 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8731 if cmd == "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8732 let cmd = "unlet"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8733 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8734 let cmd = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8735 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8736 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8737 continue " discard error if $VIMNOERRTHROW == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8738 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8739 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8741 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8742 let cmd = "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8743 XloopINIT 2097152 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8744 while cmd != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8745 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8746 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8747 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8748 let thrmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8749 call EXEC(cmd . ' {novar}') " normal plus syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8750 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8751 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8752 let thrmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8753 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8754 Xloop 1 " X: 2097152 * (1 + 32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8755 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8756 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8757 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8758 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8759 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8760 if MATCH(0, thrmsg, 'E121', "Undefined variable") " normal error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8761 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8762 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8763 if !MATCH(1, thrmsg, 'E475', 'Invalid argument\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8764 \ || v:errmsg != "" " syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8765 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8766 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8767 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8768 if !caught && !MATCH(1, v:errmsg, 'E475', 'Invalid argument\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8769 " last error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8770 Xloop 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8771 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8772 if cmd == "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8773 let cmd = "unlet"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8774 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8775 let cmd = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8776 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8777 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8778 continue " discard error if $VIMNOERRTHROW == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8779 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8780 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8781
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8782 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8783 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8784 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8785 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8786 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8787
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8788 unlet! next_command thrmsg match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8789 delfunction NEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8790 delfunction EXEC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8791 delfunction MATCH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8793 Xcheck 70288929
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8794
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8795
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8796 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8797 " Test 80: Syntax error in expression for illegal :elseif {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8798 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8799 " If there is a syntax error in the expression after an illegal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8800 " :elseif, an error message is given (or an error exception thrown)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8801 " for the illegal :elseif rather than the expression error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8802 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8803
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8804 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8805
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8806 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8807 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8808 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8809 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8810 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8811 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8812 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8813 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8814 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8815 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8816 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8817 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8818 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8819 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8820 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8821 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8822 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8823 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8825 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8826 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8827 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8828 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8829 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8830 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8831 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8832 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8833 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8835 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8836 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8837 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8838 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8839 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8840 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8841 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8842 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8843 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8844
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8845 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8846 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8847 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8848 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8849 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8850 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8851
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8852 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8853 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8854 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8855 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8856 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8857 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8858 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8859 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8860
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8861 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8862 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8863 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8864 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8865 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8866 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8867 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8868 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8869 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8870 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8871 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8872 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8873 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8874 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8875 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8876 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8877 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8878 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8879 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8880 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8881 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8882 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8883 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8884 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8885 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8886 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8887 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8888 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8889
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8890 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8891 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8892 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8893 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8894 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8895 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8896 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8897 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8898 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8899 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8900 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8901 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8902 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8903 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8904 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8905 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8906 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8907 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8908 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8909 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8910 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8911 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8912 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8913 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8914 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8915 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8916 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8917 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8918
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8919 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8920 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8921 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8922 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8923 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8924 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8925 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8926 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8927 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8928 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8929 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8930 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8931 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8932 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8933 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8934 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8935 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8936 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8937 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8938 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8939 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8940 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8941 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8942 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8943 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8944
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8945 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8946 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8947 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8948 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8949 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8950 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8951 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8952 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8953 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8954 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8955 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8956 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8957 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8958 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8959 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8960 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8961 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8962 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8963 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8964 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8965 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8966 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8967 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8968 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8969 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8970 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8971 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8972
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8973 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8974
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8975 unlet! caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8976 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8978 Xcheck 17895765
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8980
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8981 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8982 " Test 81: Discarding exceptions after an error or interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8983 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8984 " When an exception is thrown from inside a :try conditional without
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8985 " :catch and :finally clauses and an error or interrupt occurs before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8986 " the :endtry is reached, the exception is discarded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8987 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8989 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8990
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8991 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8992 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8993 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8994 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8995 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8996 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8997 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8998 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8999 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9000 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9001 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9002 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9003 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9004 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9005 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9006 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9007 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9008
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9009 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9010 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9011 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9012 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9013 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9014 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9015 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9016 endtry " INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9017 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9018 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9019 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9020 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9021 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9022 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9024 Xcheck 387
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9025
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9026
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9027 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9028 " Test 82: Ignoring :catch clauses after an error or interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9029 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9030 " When an exception is thrown and an error or interrupt occurs before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9031 " the matching :catch clause is reached, the exception is discarded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9032 " and the :catch clause is ignored (also for the error or interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9033 " exception being thrown then).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9034 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9035
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9036 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9037
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9038 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9039 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9040 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9041 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9042 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9043 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9044 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9045 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9046 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9047 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9048 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9049 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9050 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9051 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9052 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9053 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9054 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9055 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9056 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9057 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9058 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9059 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9060
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9061 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9062 function! E()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9063 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9064 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9065 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9066 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9067 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9068 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9069 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9070 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9071 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9072 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9073 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9074 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9075 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9076 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9077 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9078 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9079 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9080 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9081 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9082 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9083
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9084 call E()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9085 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9086 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9087
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9088 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9089 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9090 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9091 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9092 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9093 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9094 catch /.*/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9095 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9096 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9097 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9098 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9099 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9100 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9101 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9102 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9103 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9104 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9105 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9106 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9108 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9109 function I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9110 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9111 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9112 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9113 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9114 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9115 catch /.*/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9116 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9117 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9118 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9119 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9120 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9121 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9122 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9123 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9124 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9125 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9126 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9128 call I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9129 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9130 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9132 Xcheck 8454401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9135 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9136 " Test 83: Executing :finally clauses after an error or interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9137 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9138 " When an exception is thrown and an error or interrupt occurs before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9139 " the :finally of the innermost :try is reached, the exception is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9140 " discarded and the :finally clause is executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9141 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9143 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9145 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9146 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9147 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9148 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9149 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9150 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9151 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9152 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9153 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9154 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9155 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9156 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9157 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9158 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9159 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9160 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9161 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9162 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9163 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9165 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9166 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9167 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9168 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9169 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9170 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9171 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9172 finally "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9173 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9174 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9175 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9176 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9177 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9178 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9179 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9180 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9182 Xcheck 2835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9185 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9186 " Test 84: Exceptions in autocommand sequences. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9187 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9188 " When an exception occurs in a sequence of autocommands for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9189 " a specific event, the rest of the sequence is not executed. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9190 " command that triggered the autocommand execution aborts, and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9191 " exception is propagated to the caller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9192 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9193 " For the FuncUndefined event under a function call expression or
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
9194 " :call command, the function is not executed, even when it has
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9195 " been defined by the autocommands before the exception occurred.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9196 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9198 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9200 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9202 function! INT()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9203 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9204 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9205 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9207 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9208 autocmd!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9210 autocmd User x1 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9211 autocmd User x1 throw "x1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9212 autocmd User x1 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9214 autocmd User x2 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9215 autocmd User x2 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9216 autocmd User x2 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9218 autocmd User x3 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9219 autocmd User x3 call INT()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9220 autocmd User x3 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9222 autocmd FuncUndefined U1 function! U1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9223 autocmd FuncUndefined U1 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9224 autocmd FuncUndefined U1 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9225 autocmd FuncUndefined U1 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9226 autocmd FuncUndefined U1 throw "U1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9227 autocmd FuncUndefined U1 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9229 autocmd FuncUndefined U2 function! U2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9230 autocmd FuncUndefined U2 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9231 autocmd FuncUndefined U2 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9232 autocmd FuncUndefined U2 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9233 autocmd FuncUndefined U2 ASDF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9234 autocmd FuncUndefined U2 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9236 autocmd FuncUndefined U3 function! U3()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9237 autocmd FuncUndefined U3 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9238 autocmd FuncUndefined U3 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9239 autocmd FuncUndefined U3 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9240 autocmd FuncUndefined U3 call INT()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9241 autocmd FuncUndefined U3 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9242 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9244 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9245 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9246 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9247 doautocmd User x1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9248 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9249 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9250 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9252 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9253 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9254 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9255 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9256 doautocmd User x2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9257 catch /asdf/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9258 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9259 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9260 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9261 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9262 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9263 " Propagate uncaught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9264 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9265 " ... but break loop for caught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9266 " or discard error and break loop if $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9267 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9268 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9269 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9270 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9272 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9273 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9274 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9275 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9276 doautocmd User x3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9277 catch /Vim:Interrupt/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9278 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9279 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9280 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9281 if !caught && !$VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9282 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9283 " Propagate uncaught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9284 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9285 " ... but break loop for caught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9286 " or discard interrupt and break loop if $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9287 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9288 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9289 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9290 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9292 if exists("*U1") | delfunction U1 | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9293 if exists("*U2") | delfunction U2 | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9294 if exists("*U3") | delfunction U3 | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9296 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9297 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9298 call U1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9299 catch /U1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9300 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9301 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9303 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9304 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9305 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9306 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9307 call U2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9308 catch /ASDF/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9309 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9310 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9311 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9312 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9313 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9314 " Propagate uncaught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9315 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9316 " ... but break loop for caught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9317 " or discard error and break loop if $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9318 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9319 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9320 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9321 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9323 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9324 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9325 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9326 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9327 call U3()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9328 catch /Vim:Interrupt/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9329 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9330 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9331 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9332 if !caught && !$VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9333 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9334 " Propagate uncaught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9335 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9336 " ... but break loop for caught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9337 " or discard interrupt and break loop if $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9338 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9339 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9340 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9341 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9342 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9343 " The Xpath command does not accept 2^31 (negative); display explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9344 exec "!echo 2147483648 >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9345 Xout "Caught" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9346 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9348 unlet caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9349 delfunction INT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9350 delfunction U1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9351 delfunction U2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9352 delfunction U3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9353 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9354 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9355 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9357 Xcheck 934782101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9358
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9359
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9360 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9361 " Test 85: Error exceptions in autocommands for I/O command events {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9362 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9363 " When an I/O command is inside :try/:endtry, autocommands to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9364 " executed after it should be skipped on an error (exception) in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9365 " command itself or in autocommands to be executed before the command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9366 " In the latter case, the I/O command should not be executed either.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9367 " Example 1: BufWritePre, :write, BufWritePost
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9368 " Example 2: FileReadPre, :read, FileReadPost.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9369 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9371 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9372
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9373 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9374 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9375 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9376 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9377 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9378 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9379 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9380 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9381 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9382 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9383 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9384 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9385 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9386 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9387 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9388 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9389 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9390 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9392 " Remove the autocommands for the events specified as arguments in all used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9393 " autogroups.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9394 function! Delete_autocommands(...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9395 let augfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9396 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9397 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9398 exec "redir >" . augfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9399 aug
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9400 redir END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9401 exec "edit" augfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9402 g/^$/d
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9403 norm G$
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9404 let wrap = "w"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9405 while search('\%( \|^\)\@<=.\{-}\%( \)\@=', wrap) > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9406 let wrap = "W"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9407 exec "norm y/ \n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9408 let argno = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9409 while argno <= a:0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9410 exec "au!" escape(@", " ") a:{argno}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9411 let argno = argno + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9412 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9413 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9414 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9415 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9416 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9417 call delete(augfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9418 break " discard errors for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9419 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9420 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9421 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9422
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9423 call Delete_autocommands("BufWritePre", "BufWritePost")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9425 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9426 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9427 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9428 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9429 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9430 au! BufWritePost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9431 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9432 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9433 write /n/o/n/e/x/i/s/t/e/n/t
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9434 catch /^Vim(write):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9435 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9436 let v:errmsg = substitute(v:exception, '^Vim(write):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9437 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9438 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9439 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9440 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9441 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9442 let v:errmsg = substitute(v:errmsg, '^"/n/o/n/e/x/i/s/t/e/n/t" ',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9443 \ '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9444 if !MSG('E212', "Can't open file for writing")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9445 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9446 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9447 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9448 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9449 Xout "BufWritePost commands executed after write error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9450 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9451 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9452 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9453 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9454 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9455 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9456 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9457 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9458 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9459 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9460 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9462 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9463 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9464 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9465 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9466 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9467 au! BufWritePre * asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9468 au! BufWritePost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9469 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9470 let tmpfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9471 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9472 exec "write" tmpfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9473 catch /^Vim\((write)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9474 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9475 let v:errmsg = substitute(v:exception, '^Vim\((write)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9476 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9477 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9478 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9479 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9480 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9481 let v:errmsg = substitute(v:errmsg, '^"'.tmpfile.'" ', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9482 if !MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9483 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9484 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9485 if filereadable(tmpfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9486 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9487 Xout ":write command not suppressed after BufWritePre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9488 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9489 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9490 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9491 Xout "BufWritePost commands executed after BufWritePre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9492 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9493 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9494 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9495 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9496 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9497 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9498 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9499 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9500 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9501 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9502 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9503
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9504 call delete(tmpfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9505
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9506 call Delete_autocommands("BufWritePre", "BufWritePost",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9507 \ "BufReadPre", "BufReadPost", "FileReadPre", "FileReadPost")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9509 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9510 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9511 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9512 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9513 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9514 au! FileReadPost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9515 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9516 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9517 read /n/o/n/e/x/i/s/t/e/n/t
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9518 catch /^Vim(read):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9519 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9520 let v:errmsg = substitute(v:exception, '^Vim(read):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9521 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9522 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9523 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9524 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9525 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9526 let v:errmsg = substitute(v:errmsg, ' /n/o/n/e/x/i/s/t/e/n/t$',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9527 \ '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9528 if !MSG('E484', "Can't open file")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9529 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9530 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9531 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9532 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9533 Xout "FileReadPost commands executed after write error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9534 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9535 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9536 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9537 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9538 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9539 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9540 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9541 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9542 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9543 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9544 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9546 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9547 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9548 let infile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9549 let tmpfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9550 exec "!echo XYZ >" . infile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9551 exec "edit" tmpfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9552 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9553 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9554 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9555 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9556 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9557 au! FileReadPre * asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9558 au! FileReadPost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9559 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9560 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9561 exec "0read" infile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9562 catch /^Vim\((read)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9563 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9564 let v:errmsg = substitute(v:exception, '^Vim\((read)\)\=:', '',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9565 \ "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9566 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9567 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9568 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9569 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9570 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9571 let v:errmsg = substitute(v:errmsg, ' '.infile.'$', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9572 if !MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9573 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9574 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9575 if getline("1") == "XYZ"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9576 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9577 Xout ":read command not suppressed after FileReadPre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9578 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9579 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9580 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9581 Xout "FileReadPost commands executed after " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9582 \ "FileReadPre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9583 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9584 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9585 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9586 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9587 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9588 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9589 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9590 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9591 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9592 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9593 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9594 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9595 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9596 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9598 call delete(infile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9599 call delete(tmpfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9600 unlet! caught post infile tmpfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9601 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9602 delfunction Delete_autocommands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9603
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9604 Xcheck 198689
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9605
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9606
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9607 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9608 " Test 86: $VIMNOERRTHROW and $VIMNOINTTHROW support {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9609 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9610 " It is possible to configure Vim for throwing exceptions on error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9611 " or interrupt, controlled by variables $VIMNOERRTHROW and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9612 " $VIMNOINTTHROW. This is just for increasing the number of tests.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9613 " All tests here should run for all four combinations of setting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9614 " these variables to 0 or 1. The variables are intended for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9615 " development phase only. In the final release, Vim should be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9616 " configured to always use error and interrupt exceptions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9617 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9618 " The test result is "OK",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9619 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9620 " - if the $VIMNOERRTHROW and the $VIMNOINTTHROW control are not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9621 " configured and exceptions are thrown on error and on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9622 " interrupt.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9623 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9624 " - if the $VIMNOERRTHROW or the $VIMNOINTTHROW control is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9625 " configured and works as intended.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9626 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9627 " What actually happens, is shown in the test output.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9628 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9629 " Otherwise, the test result is "FAIL", and the test output describes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9630 " the problem.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9631 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9632 " IMPORTANT: This must be the last test because it sets $VIMNOERRTHROW and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9633 " $VIMNOINTTHROW.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9634 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9636 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9637
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9638 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9640 function! ThrowOnError()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9641 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9642 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9643 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9644 Xloop 1 " X: 1 + 8 + 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9645 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9646 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9647 let caught = 1 " error exception caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9648 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9649 Xloop 2 " X: 2 + 16 + 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9650 return caught " discard aborting error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9651 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9652 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9653 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9654
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9655 let quits_skipped = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9657 function! ThrowOnInterrupt()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9658 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9659 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9660 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9661 Xloop 1 " X: (1 + 8 + 64) * 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9662 "INTERRUPT3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9663 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9664 let g:quits_skipped = g:quits_skipped + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9665 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9666 let caught = 1 " interrupt exception caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9667 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9668 Xloop 2 " X: (2 + 16 + 128) * 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9669 return caught " discard interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9670 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9671 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9672 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9674 function! CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9675 execute 'return ThrowOn' . a:Type . '()'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9676 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9678 function! CheckConfiguration(type) " type is "error" or "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9679
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9680 let type = a:type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9681 let Type = substitute(type, '.*', '\u&', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9682 let VAR = '$VIMNO' . substitute(type, '\(...\).*', '\U\1', "") . 'THROW'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9683
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9684 if type == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9685 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9686 elseif type == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9687 XloopINIT! 512 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9688 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9689
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9690 exec 'let requested_for_tests = exists(VAR) && ' . VAR . ' == 0'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9691 exec 'let suppressed_for_tests = ' . VAR . ' != 0'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9692 let used_in_tests = CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9693
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9694 exec 'let ' . VAR . ' = 0'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9695 let request_works = CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9697 exec 'let ' . VAR . ' = 1'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9698 let suppress_works = !CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9699
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9700 if type == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9701 XloopINIT! 262144 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9702 elseif type == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9703 XloopINIT! 2097152 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9704
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9705 if g:quits_skipped != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9706 Xloop 1 " X: 0*2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9707 Xout "Test environment error. Interrupt breakpoints skipped: "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9708 \ . g:quits_skipped . ".\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9709 \ . "Cannot check whether interrupt exceptions are thrown."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9710 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9711 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9712 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9714 let failure =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9715 \ !suppressed_for_tests && !used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9716 \ || !request_works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9717
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9718 let contradiction =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9719 \ used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9720 \ ? suppressed_for_tests && !request_works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9721 \ : !suppressed_for_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9722
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9723 if failure
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9724 " Failure in configuration.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9725 Xloop 2 " X: 0 * 2* (262144 + 2097152)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9726 elseif contradiction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9727 " Failure in test logic. Should not happen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9728 Xloop 4 " X: 0 * 4 * (262144 + 2097152)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9729 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9730
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9731 let var_control_configured =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9732 \ request_works != used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9733 \ || suppress_works == used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9734
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9735 let var_control_not_configured =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9736 \ requested_for_tests || suppressed_for_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9737 \ ? request_works && !suppress_works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9738 \ : request_works == used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9739 \ && suppress_works != used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9741 let with = used_in_tests ? "with" : "without"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9743 let set = suppressed_for_tests ? "non-zero" :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9744 \ requested_for_tests ? "0" : "unset"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9746 let although = contradiction && !var_control_not_configured
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9747 \ ? ",\nalthough "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9748 \ : ".\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9749
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9750 let output = "All tests were run " . with . " throwing exceptions on "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9751 \ . type . although
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9753 if !var_control_not_configured
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9754 let output = output . VAR . " was " . set . "."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9756 if !request_works && !requested_for_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9757 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9758 \ "\n" . Type . " exceptions are not thrown when " . VAR .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9759 \ " is\nset to 0."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9760 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9761
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9762 if !suppress_works && (!used_in_tests ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9763 \ !request_works &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9764 \ !requested_for_tests && !suppressed_for_tests)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9765 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9766 \ "\n" . Type . " exceptions are thrown when " . VAR .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9767 \ " is set to 1."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9768 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9769
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9770 if !failure && var_control_configured
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9771 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9772 \ "\nRun tests also with " . substitute(VAR, '^\$', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9773 \ . "=" . used_in_tests . "."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9774 \ . "\nThis is for testing in the development phase only."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9775 \ . " Remove the \n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9776 \ . VAR . " control in the final release."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9777 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9778 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9779 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9780 \ "The " . VAR . " control is not configured."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9781 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9782
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9783 Xout output
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9784 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9786 call CheckConfiguration("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9787 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9788 call CheckConfiguration("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9789 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9790 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9791
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9792 Xcheck 50443995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9793
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9794 " IMPORTANT: No test should be added after this test because it changes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9795 " $VIMNOERRTHROW and $VIMNOINTTHROW.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9796
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9797
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9798 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9799 " Modelines {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9800 " vim: ts=8 sw=4 tw=80 fdm=marker
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9801 " vim: fdt=substitute(substitute(foldtext(),\ '\\%(^+--\\)\\@<=\\(\\s*\\)\\(.\\{-}\\)\:\ \\%(\"\ \\)\\=\\(Test\ \\d*\\)\:\\s*',\ '\\3\ (\\2)\:\ \\1',\ \"\"),\ '\\(Test\\s*\\)\\(\\d\\)\\D\\@=',\ '\\1\ \\2',\ "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9802 "-------------------------------------------------------------------------------