annotate src/testdir/test49.vim @ 19952:82ea10d554fb v8.2.0532

patch 8.2.0532: cannot use simplify() as a method Commit: https://github.com/vim/vim/commit/7035fd9d909c49cf5105a53753c1772c193d05b8 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 8 20:03:52 2020 +0200 patch 8.2.0532: cannot use simplify() as a method Problem: Cannot use simplify() as a method. Solution: Add FEARG_1. (closes https://github.com/vim/vim/issues/5996)
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Apr 2020 20:15:04 +0200
parents eff8d8f72a82
children 792398a9fe39
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>
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
3 " Last Change: 2019 Nov 03
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
18829
eff8d8f72a82 patch 8.1.2402: typos and other small things
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
181 " omitted (default: 1).
7
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 "
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10942
diff changeset
321 function ExtraVim(...)
7
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 . "'" : ""
18269
57b18521216f patch 8.1.2129: using hard coded executable path in test
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
459 exec "!echo '" . debug_quits . "q' | " .. v:progpath .. " -u NONE -N -Xes" . redirect .
7
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.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10942
diff changeset
503 function ExtraVimThrowpoint()
7
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
17918
9606c0adc148 patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
524 " variable, and every ":call" by a ":source" for the next following argument
7
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.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10942
diff changeset
533 function MakeScript(funcname, ...)
7
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.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10942
diff changeset
571 function ExecAsScript(funcname)
7
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
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
611 " Tests 1 to 17 were moved to test_vimscript.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
612 let Xtest = 18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 " Test 18: Interrupt (Ctrl-C pressed) {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 " On an interrupt, the script processing is terminated immediately.
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 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 endif | Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 endwhile | Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 endif | Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 endtry | Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 endif | Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 Xpath Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 endwhile | Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 Xpath Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 endif | Xpath Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 Xpath Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 call F() | Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 endtry | Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 call G() | Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 " The Xpath command does not accept 2^31 (negative); display explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 exec "!echo 2147483648 >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 Xcheck 67224583
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 " Test 19: Aborting on errors inside :try/:endtry {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 " An error in a command dynamically enclosed in a :try/:endtry region
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 " aborts script processing immediately. It does not matter whether
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 " the failing command is outside or inside a function and whether a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 " function has an "abort" attribute.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 function! F() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 endtry | Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 endtry | Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 endtry | Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 endtry | Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 endif | Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 endtry | Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 endwhile | Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 endwhile | Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 Xcheck 69275973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 " Test 20: Aborting on errors after :try/:endtry {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 " When an error occurs after the last active :try/:endtry region has
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 " been left, termination behavior is as if no :try/:endtry has been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 " seen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 endwhile | Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 let p = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 while p
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 let p = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 Xcheck 1874575085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 " Test 21: :finally for :try after :continue/:break/:return/:finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 " If a :try conditional stays inactive due to a preceding :continue,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 " :break, :return, or :finish, its :finally clause should not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 " executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 function F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 let loops = 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 XloopINIT! 1 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 while loops > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 let loops = loops - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 if loops == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 Xloop 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 elseif loops == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 Xloop 4 " X: 4*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 Xloop 8 " X: 0
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 try " inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 Xloop 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 Xloop 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 Xloop 64 " X: 64 + 64*256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 Xloop 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 try " inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 try " inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 Xcheck 147932225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967
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 " Test 22: :finally for a :try after an error/interrupt/:throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 " If a :try conditional stays inactive due to a preceding error or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 " interrupt or :throw, its :finally clause should not be executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 function! Error()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 asdf " aborting error, triggering error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 call Error()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 if 1 " not active due to error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 try " not active due to error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 function! Interrupt()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 "INTERRUPT " triggering interrupt exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 call Interrupt()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 if 1 " not active due to interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 try " not active due to interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 function! Throw()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 throw "xyz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 call Throw()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 if 1 " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 try " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 Xcheck 4161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 " Test 23: :catch clauses for a :try after a :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 " If a :try conditional stays inactive due to a preceding :throw,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 " none of its :catch clauses should be executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 throw "xyz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 if 1 " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 try " not active since :if inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 try " not active due to :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 catch /abc/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 Xcheck 49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 " Test 24: :endtry for a :try after a :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 " If a :try conditional stays inactive due to a preceding :throw,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 " its :endtry should not rethrow the exception to the next surrounding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 " active :try conditional.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 try " try 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 try " try 2
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 throw "xyz" " makes try 2 inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 try " try 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116 endtry " no rethrow to try 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 catch /xyz/ " should catch although try 2 inactive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 catch /xyz/ " try 1 active, but exception already caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 Xcheck 41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
1128 " Tests 25 and 26 were moved to test_trycatch.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
1129 let Xtest = 27
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 " Test 27: Executing :finally clauses after :return {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 " For a :return command dynamically enclosed in a :try/:endtry region,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 " :finally clauses are executed and the called function is ended.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 call H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 Xcheck 1996459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 " Leave F, G, and H for execution as scripts in the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 " Test 28: Executing :finally clauses after :finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 " For a :finish command dynamically enclosed in a :try/:endtry region,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 " :finally clauses are executed and the sourced file is finished.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 " This test executes the bodies of the functions F, G, and H from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 " previous test as script files (:return replaced by :finish).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 let scriptF = MakeScript("F") " X: 1 + 2 + 8 + 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 let scriptG = MakeScript("G", scriptF) " X: 128 + 512 + 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 let scriptH = MakeScript("H", scriptG) " X: 4096 + 8192 + 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 exec "source" scriptH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 call delete(scriptF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 call delete(scriptG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 call delete(scriptH)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 unlet scriptF scriptG scriptH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 Xcheck 1996459
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 29: Executing :finally clauses on errors {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 " After an error in a command dynamically enclosed in a :try/:endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 " region, :finally clauses are executed and the script processing is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 " terminated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 Xpath 2 " X: 2
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 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 endtry | Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 endtry | Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 endwhile | Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 endtry | Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 endwhile | Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 function! G() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 asdf " error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 endtry | Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 endif | Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 endtry | Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 endif | Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 Xcheck 170428555
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316 " Test 30: Executing :finally clauses on interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 " After an interrupt in a command dynamically enclosed in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319 " a :try/:endtry region, :finally clauses are executed and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320 " script processing is terminated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326 XloopINIT 1 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 Xloop 1 " X: 1 + 1*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 Xloop 4 " X: 4 + 4*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1343 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 ExecAsScript F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 Xcheck 190905173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 " Test 31: Executing :finally clauses after :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 " After a :throw dynamically enclosed in a :try/:endtry region,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 " :finally clauses are executed and the script processing is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 " terminated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 XloopINIT 1 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 Xloop 1 " X: 1 + 1*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 throw "exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 Xloop 4 " X: 4 + 4*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 throw "exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 throw "exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 ExecAsScript F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 Xcheck 190905173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
1466 " Tests 32 and 33 were moved to test_trycatch.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
1467 let Xtest = 34
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 " Test 34: :finally reason discarded by :continue {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 " discarded by a :continue in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 function! C(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506 continue " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 Xloop 4 " X: 4*(1+8+64+512+4096+32768+262144)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 call C("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 call C("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 call C("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 ExecAsScript C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 call C("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 call C("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 call C("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 delfunction C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 Xcheck 2146584868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 " Test 35: :finally reason discarded by :break {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 " discarded by a :break in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 function! B(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 break " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 Xloop 4 " X: 4*(1+8+64+512+4096+32768+262144)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 call B("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 call B("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 call B("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 ExecAsScript B
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 call B("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 call B("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 call B("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 delfunction B
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 Xcheck 2146584868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 " Test 36: :finally reason discarded by :return {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 " discarded by a :return in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 function! R(jump, retval) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 elseif a:jump == "return"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 return a:retval " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 Xloop 2 " 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 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 let sum = -R("continue", -8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 let sum = sum - R("break", -16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 let sum = sum - R("return", -32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 let sum = sum - R("error", -64)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 let sum = sum - R("interrupt", -128)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 let sum = sum - R("throw", -256)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 let expected = 8 + 16 + 32 + 64 + 128 + 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 if sum != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 Xout "sum =" . sum . ", expected: " . expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 unlet sum expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 delfunction R
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 Xcheck 1071644672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 " Test 37: :finally reason discarded by :finish {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 " discarded by a :finish in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 function! F(jump) " not executed as function, transformed to a script
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 elseif a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 finish " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 Xloop 4 " 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 let scriptF = MakeScript("F")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 let g:jump = "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 let g:jump = "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 let g:jump = "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 let g:jump = "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 let g:jump = "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 call delete(scriptF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 unlet scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 Xcheck 1071644672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 " Test 38: :finally reason discarded by an error {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 " discarded by an error in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 function! E(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 asdf " error; discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 call E("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 call E("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 call E("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 ExecAsScript E
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 call E("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 call E("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 call E("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 delfunction E
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 Xcheck 357908480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 " Test 39: :finally reason discarded by an interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 " discarded by an interrupt in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 function! I(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1928 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1933 "INTERRUPT - discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1938 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1940 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1941 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1943 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1944 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1945 call I("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 call I("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1954 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 call I("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1956 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1961 ExecAsScript I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1964 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967 call I("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972 call I("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977 call I("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981 delfunction I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1988 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 Xcheck 357908480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1997 " Test 40: :finally reason discarded by :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 " When a :finally clause is executed due to a :continue, :break,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 " :return, :finish, error, interrupt or :throw, the jump reason is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 " discarded by a :throw in the finally clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 function! T(jump)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012 let loop = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013 while loop < 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 let loop = loop + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015 if loop == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2016 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2017 if a:jump == "continue"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019 elseif a:jump == "break"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021 elseif a:jump == "return" || a:jump == "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 elseif a:jump == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025 elseif a:jump == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 elseif a:jump == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2029 throw "abc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 throw "xyz" " discards jump that caused the :finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2034 elseif loop == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 Xloop 2 " X: 0
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 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043 call T("continue")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2047 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048 call T("break")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2050 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 call T("return")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054 Xpath 524288 " 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 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 let g:jump = "finish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 ExecAsScript T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 unlet g:jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 call T("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 call T("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 Xpath 33554432 " 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 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 call T("throw")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 delfunction T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091 Xcheck 357908480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
2093 " Tests 41 to 48 were moved to test_trycatch.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
2094 let Xtest = 49
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
2098 " Test 49: Throwing exceptions across functions {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 " When an exception is thrown but not caught inside a function, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101 " caller is checked for a matching :catch clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 function! C()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2115 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 XloopINIT! 16 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 function! T1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 Xloop 1 " X: 16 + 16*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126 Xloop 4 " X: 64 + 64*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131 function! T2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 call T1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 call C() " throw and catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153 call T1() " throw, one level
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 call T2() " throw, two levels
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2171 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2172 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2174 Xcheck 179000669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2176 " Leave C, T1, and T2 for execution as scripts in the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2178
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2179 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
2180 " Test 50: Throwing exceptions across script files {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 " When an exception is thrown but not caught inside a script file,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183 " the sourcing script or function is checked for a matching :catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 " clause.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 " This test executes the bodies of the functions C, T1, and T2 from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 " the previous test as script files (:return replaced by :finish).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 let scriptC = MakeScript("C") " X: 1 + 4 + 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 delfunction C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 XloopINIT! 16 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 let scriptT1 = MakeScript("T1") " X: 16 + 64 + 16*16 + 64*16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 delfunction T1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 let scriptT2 = MakeScript("T2", scriptT1) " X: 4096 + 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201 delfunction T2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206 exec "source" g:scriptC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 exec "source" g:scriptT1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2216 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 exec "source" scriptT2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 call delete(scriptC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 call delete(scriptT1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 call delete(scriptT2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 unlet scriptC scriptT1 scriptT2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 Xcheck 363550045
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
2247 " Test 51 was moved to test_trycatch.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
2248 let Xtest = 52
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 " Test 52: Uncaught exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 " When an exception is thrown but not caught, an error message is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 " displayed when the script is terminated. In case of an interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 " or error exception, the normal interrupt or error message(s) are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 " displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 function! MESSAGES(...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2266 exec "edit" g:msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2267 catch /^Vim(edit):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2268 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2269 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 norm gg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275 let num = a:0 / 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 let cnt = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277 while cnt <= num
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 let enr = a:{2*cnt - 1}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 let emsg= a:{2*cnt}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280 let cnt = cnt + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 if enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 Xout "TODO: Add message number for:" emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 elseif enr == "INT"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 let enr = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 if enr == "" && !english
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 let pattern = (enr != "") ? enr . ':.*' : ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 if english
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 let pattern = pattern . emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 if !search(pattern, "W")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296 Xout "No match for:" pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 norm $
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2310 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2312 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2322 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2328 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2330 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331 function! T()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332 throw "brrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2338 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340 call T()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2341 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 throw "brrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2359 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2361 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2362 if !MESSAGES('E605', "Exception not caught")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2363 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2366 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 if !MESSAGES('INT', "Interrupted")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381 Xpath 4194304 " X: 4194304
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
2382 let x = novar " error E121; exception: E121
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2383 catch /E15:/ " should not catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2384 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 Xpath 33554432 " X: 33554432
15456
f01eb1aed348 patch 8.1.0736: code for Blob not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
2390 if !MESSAGES('E121', "Undefined variable")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2393
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2394 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2395 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2396 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2397 " unlet novar # " error E108/E488; exception: E488
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 catch /E108:/ " should not catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405 if !MESSAGES('E108', "No such variable", 'E488', "Trailing characters")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2407 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2408 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2411 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2413 Xcheck 1247112011
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 " Leave MESSAGES() for the next tests.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2418 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 " Test 53: Nesting errors: :endif/:else/:elseif {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421 " For nesting errors of :if conditionals the correct error messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 " should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2424 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2425 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2429
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2432 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2433 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2434 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2435 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2436 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2440 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2441 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2442 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2443 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2444 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2445 Xpath 2 " X: 2
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(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2449 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2450 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2451 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2452 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2453 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2454 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2455 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2456 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2457
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2458 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2459 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2460 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2461 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2462 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2469 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 if MESSAGES('E580', ":endif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2480 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2481 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2487 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2491 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2492 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2498 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2499 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2504 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2506 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2516 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520 if MESSAGES('E581', ":else without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2525 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2526 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2527 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2530
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2531 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2533 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2535 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2537 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2542 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2543 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2545 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2546 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 Xpath 4096 " X: 4096
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 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2557 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2561 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 " elseif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2564 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2566 if MESSAGES('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576 if MESSAGES('E583', "multiple :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582 " else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583 " elseif 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 if MESSAGES('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2591 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2592
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593 Xcheck 131071
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2594
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2595 " Leave MESSAGES() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 " Test 54: Nesting errors: :while/:endwhile {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2601 " For nesting errors of :while conditionals the correct error messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2602 " should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2606 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2607
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2612 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2613 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2616 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2617 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2619 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2623 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2624 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2625 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2626 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2627
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2628 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2629 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2630 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2631 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2632 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2633 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2634 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2635 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2637 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2638 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2639 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2647 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2652 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 if MESSAGES('E600', "Missing :endtry")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664 if MESSAGES('E600', "Missing :endtry")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2666 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2667
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2668 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2669 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2670 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2671 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2672 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2673 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2677 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2679 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2680 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2683 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2707 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2715 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2719 if MESSAGES('E588', ":endwhile without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2720 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2721 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2722
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2723
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2724 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2725 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2726
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2727 Xcheck 2047
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2729 " Leave MESSAGES() for the next test.
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 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2733 " Test 55: Nesting errors: :continue/:break {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2734 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2735 " For nesting errors of :continue and :break commands the correct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2736 " error messages should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2737 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2738 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2739 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2740 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2743
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2746 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2747 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2748 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2749 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2750 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2756 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2757 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2758 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2759 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2760 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2761
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2762 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2763 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2765 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2766 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2767 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2768 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2769 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2770 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2771
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2772 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2773 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2774 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2775 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2776 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2777 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2778 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2779 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2780
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2783 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2784 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2785 " continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2788 if MESSAGES('E586', ":continue without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2803 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2819 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2820 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2821 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2824 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2830 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831 " break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834 if MESSAGES('E587', ":break without :while")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2837
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2838 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 Xcheck 1023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843 " Leave MESSAGES() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 " Test 56: Nesting errors: :endtry {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 " For nesting errors of :try conditionals the correct error messages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 " should be given.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 " This test reuses the function MESSAGES() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853 " This functions checks the messages in g:msgfile.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858 let msgfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863 if MESSAGES('E602', ":endtry without :try")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2864 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2865 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2866
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2867 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2868 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2869 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2870 " endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2871 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2872 if MESSAGES('E602', ":endtry without :try")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2873 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2874 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2875
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2876 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2877 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2878 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2879 " endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2880 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2881 if MESSAGES('E602', ":endtry without :try")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2882 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2883 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2884
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2885 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2886 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2887 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2888 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2889 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2890 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2891 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2892 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2893
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2894 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2895 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2896 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2897 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2898 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2899 if MESSAGES('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2900 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2901 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2902
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2903 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2904 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2905 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2906 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2907 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2908 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2909 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2910 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2911 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2913 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2914 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2915 " finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2916 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2917 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2918 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2919 if MESSAGES('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2920 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2921 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2923 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2924 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2925 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2926 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2927 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2928 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2929 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2930 if MESSAGES('E171', "Missing :endif")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2931 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2932 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2933
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2934 if ExtraVim(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2935 " try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2936 " throw "a"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2937 " catch /a/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2938 " while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2939 " endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2940 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2941 if MESSAGES('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2942 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2943 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2944
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2945 call delete(msgfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2946 unlet msgfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2947
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2948 delfunction MESSAGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2949
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2950 Xcheck 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2951
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2952
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2953 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2954 " Test 57: v:exception and v:throwpoint for user exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2955 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2956 " v:exception evaluates to the value of the exception that was caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2957 " most recently and is not finished. (A caught exception is finished
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2958 " when the next ":catch", ":finally", or ":endtry" is reached.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2959 " v:throwpoint evaluates to the script/function name and line number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2960 " where that exception has been thrown.
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 function! FuncException()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2966 let g:exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2967 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2968
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2969 function! FuncThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2970 let g:throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2971 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2972
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2973 let scriptException = MakeScript("FuncException")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2974 let scriptThrowPoint = MakeScript("FuncThrowpoint")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2975
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2976 command! CmdException let g:exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2977 command! CmdThrowpoint let g:throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2978
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2979 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2980
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2981 function! CHECK(n, exception, throwname, throwline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2982 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2983 let error = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2984 if v:exception != a:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2985 Xout a:n.": v:exception is" v:exception "instead of" a:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2986 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2987 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2988 if v:throwpoint !~ a:throwname
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2989 let name = escape(a:throwname, '\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2990 Xout a:n.": v:throwpoint (".v:throwpoint.") does not match" name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2991 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2992 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2993 if v:throwpoint !~ a:throwline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2994 let line = escape(a:throwline, '\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2995 Xout a:n.": v:throwpoint (".v:throwpoint.") does not match" line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2996 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2997 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2998 if error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2999 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3000 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3001 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3003 function! T(arg, line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3004 if a:line == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3005 throw a:arg " in line 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3006 elseif a:line == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3007 throw a:arg " in line 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3008 elseif a:line == 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3009 throw a:arg " in line 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3010 elseif a:line == 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3011 throw a:arg " in line 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3012 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3013 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3014
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3015 function! G(arg, line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3016 call T(a:arg, a:line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3017 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3018
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3019 function! F(arg, line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3020 call G(a:arg, a:line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3021 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3022
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3023 let scriptT = MakeScript("T")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3024 let scriptG = MakeScript("G", scriptT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3025 let scriptF = MakeScript("F", scriptG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3026
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3027 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3028 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3029 call F("oops", 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3030 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3031 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3032 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3033 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3034 call CHECK(1, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3035 exec "let exception = v:exception"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3036 exec "let throwpoint = v:throwpoint"
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3037 call CHECK(2, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3038 CmdException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3039 CmdThrowpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3040 call CHECK(3, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3041 call FuncException()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3042 call FuncThrowpoint()
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3043 call CHECK(4, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3044 exec "source" scriptException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3045 exec "source" scriptThrowPoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3046 call CHECK(5, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3047 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3048 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3049 call G("arrgh", 4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3050 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3051 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3052 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3053 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3054 call CHECK(6, "arrgh", '\<G\[1]\.\.T\>', '\<4\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3055 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3056 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3057 let g:arg = "autsch"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3058 let g:line = 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3059 exec "source" scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3060 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3061 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3062 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3063 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3064 " Symbolic links in tempname()s are not resolved, whereas resolving
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3065 " is done for v:throwpoint. Resolve the temporary file name for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3066 " scriptT, so that it can be matched against v:throwpoint.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3067 call CHECK(7, "autsch", resolve(scriptT), '\<6\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3068 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3069 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3070 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3071 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3072 call CHECK(8, "arrgh", '\<G\[1]\.\.T\>', '\<4\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3073 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3074 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3075 let g:arg = "brrrr"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3076 let g:line = 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3077 exec "source" scriptG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3078 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3079 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3080 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3081 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3082 " Resolve scriptT for matching it against v:throwpoint.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3083 call CHECK(9, "brrrr", resolve(scriptT), '\<8\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3084 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3085 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3086 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3087 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3088 call CHECK(10, "arrgh", '\<G\[1]\.\.T\>', '\<4\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3089 endtry
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 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3092 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3093 call CHECK(11, "arrgh", '\<G\[1]\.\.T\>', '\<4\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3094 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3095 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3096 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3097 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3098 call CHECK(12, "arrgh", '\<G\[1]\.\.T\>', '\<4\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3099 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3100 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3101 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3102 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3103 call CHECK(13, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3104 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3105 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3106 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3107 let throwpoint = v:throwpoint
7139
d1e35ca56c73 commit https://github.com/vim/vim/commit/0a777ab9890ba0e8dd57f082e98fde1adab36aa0
Christian Brabandt <cb@256bit.org>
parents: 4774
diff changeset
3108 call CHECK(14, "oops", '\<F\[1]\.\.G\[1]\.\.T\>', '\<2\>')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3109 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3110 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3111 let exception = v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3112 let throwpoint = v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3113 call CHECK(15, "", '^$', '^$')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3114 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3116 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3118 unlet exception throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3119 delfunction FuncException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3120 delfunction FuncThrowpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3121 call delete(scriptException)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3122 call delete(scriptThrowPoint)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3123 unlet scriptException scriptThrowPoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3124 delcommand CmdException
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3125 delcommand CmdThrowpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3126 delfunction T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3127 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3128 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3129 call delete(scriptT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3130 call delete(scriptG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3131 call delete(scriptF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3132 unlet scriptT scriptG scriptF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3134 Xcheck 2147450880
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3137 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3138 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3139 " Test 58: v:exception and v:throwpoint for error/interrupt exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3140 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3141 " v:exception and v:throwpoint work also for error and interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3142 " exceptions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3143 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3145 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3147 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3149 function! T(line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3150 if a:line == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3151 delfunction T " error (function in use) in line 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3152 elseif a:line == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3153 let dummy = 0 " INTERRUPT1 - interrupt in line 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3154 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3155 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3157 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3158 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3159 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3160 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3161 call T(2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3162 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3163 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3164 if v:exception !~ 'Vim(delfunction):'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3165 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3166 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3167 if v:throwpoint !~ '\<T\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3168 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3169 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3170 if v:throwpoint !~ '\<2\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3171 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3172 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3173 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3174 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3175 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3176 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3177 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3178 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3179 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3180 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3181 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3182 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3183 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3184 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3185 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3186 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3188 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3189 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3190 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3191 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3192 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3193 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3194 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3196 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3197 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3198 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3199 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3200 call T(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3201 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3202 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3203 if v:exception != 'Vim:Interrupt'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3204 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3205 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3206 if v:throwpoint !~ '\<T\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3207 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3208 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3209 if v:throwpoint !~ '\<4\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3210 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3211 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3212 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3213 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3214 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3215 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3216 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3217 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3218 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3219 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3220 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3221 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3222 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3223 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3224 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3225 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3227 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3228 if v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3229 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3230 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3231 if v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3232 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3233 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3235 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3237 Xcheck 624945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3240 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3241 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3242 " Test 59: v:exception and v:throwpoint when discarding exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3243 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3244 " When a :catch clause is left by a ":break" etc or an error or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3245 " interrupt exception, v:exception and v:throwpoint are reset. They
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3246 " are not affected by an exception that is discarded before being
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3247 " caught.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3248 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3250 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3252 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3253
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3254 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3256 let sfile = expand("<sfile>")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3258 function! LineNumber()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3259 return substitute(substitute(v:throwpoint, g:sfile, '', ""),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3260 \ '\D*\(\d*\).*', '\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3261 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3263 command! -nargs=1 SetLineNumber
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3264 \ try | throw "line" | catch /.*/ | let <args> = LineNumber() | endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3266 " Check v:exception/v:throwpoint against second/fourth parameter if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3267 " specified, check for being empty else.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3268 function! CHECK(n, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3269 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3270 let exception = a:0 != 0 ? a:1 : "" " second parameter (optional)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3271 let emsg = a:0 != 0 ? a:2 : "" " third parameter (optional)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3272 let line = a:0 != 0 ? a:3 : 0 " fourth parameter (optional)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3273 let error = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3274 if emsg != ""
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
3275 " exception is the error number, emsg the English error message text
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3276 if exception !~ '^E\d\+$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3277 Xout "TODO: Add message number for:" emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3278 elseif v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3279 if exception == "E492" && emsg == "Not an editor command"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3280 let exception = '^Vim:' . exception . ': ' . emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3281 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3282 let exception = '^Vim(\a\+):' . exception . ': ' . emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3283 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3284 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3285 if exception == "E492"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3286 let exception = '^Vim:' . exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3287 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3288 let exception = '^Vim(\a\+):' . exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3289 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3290 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3291 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3292 if exception == "" && v:exception != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3293 Xout a:n.": v:exception is set:" v:exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3294 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3295 elseif exception != "" && v:exception !~ exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3296 Xout a:n.": v:exception (".v:exception.") does not match" exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3297 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3298 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3299 if line == 0 && v:throwpoint != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3300 Xout a:n.": v:throwpoint is set:" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3301 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3302 elseif line != 0 && v:throwpoint !~ '\<' . line . '\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3303 Xout a:n.": v:throwpoint (".v:throwpoint.") does not match" line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3304 let error = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3305 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3306 if !error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3307 Xloop 1 " X: 2097151
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3308 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3309 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3311 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3312 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3313 throw "x1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3314 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3315 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3316 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3317 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3318 call CHECK(1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3320 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3321 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3322 throw "x2"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3323 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3324 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3325 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3326 call CHECK(2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3327 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3328 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3329 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3330 call CHECK(3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3332 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3333 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3334 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3335 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3336 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3337 throw "x3"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3338 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3339 SetLineNumber line_before_error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3340 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3341 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3342 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3343 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3344 call CHECK(4, 'E492', "Not an editor command",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3345 \ line_before_error + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3346 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3347 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3348 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3349 call CHECK(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3350 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3351 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3352 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3353 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3354 call CHECK(5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3356 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3358 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3359 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3360 let intcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3361 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3362 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3363 throw "x4"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3364 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3365 SetLineNumber two_lines_before_interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3366 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3367 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3368 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3369 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3370 let intcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3371 call CHECK(6, "Vim:Interrupt", '',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3372 \ two_lines_before_interrupt + 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3373 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3374 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3375 if !intcaught && $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3376 call CHECK(6)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3377 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3378 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3379 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3380 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3381 call CHECK(7)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3382
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3383 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3385 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3386 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3387 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3388 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3389 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3390 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3391 SetLineNumber line_before_throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3392 throw "x5"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3393 " missing endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3394 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3395 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3396 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3397 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3398 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3399 call CHECK(8, 'E171', "Missing :endif", line_before_throw + 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3400 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3401 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3402 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3403 call CHECK(8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3404 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3405 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3406 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3407 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3408 call CHECK(9)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3410 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3412 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3413 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3414 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3415 throw "x6"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3416 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3417 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3418 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3419 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3420 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3421 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3422 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3423 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3424 call CHECK(10)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3426 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3427 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3428 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3429 throw "x7"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3430 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3431 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3432 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3433 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3434 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3435 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3436 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3437 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3438 call CHECK(11)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3439 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3440 call CHECK(12)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3442 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3443 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3444 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3445 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3446 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3447 throw "x8"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3448 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3449 SetLineNumber line_before_error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3450 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3451 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3452 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3453 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3454 call CHECK(13, 'E492', "Not an editor command",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3455 \ line_before_error + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3456 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3457 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3458 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3459 call CHECK(13)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3460 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3461 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3462 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3463 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3464 call CHECK(14)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3466 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3467
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3468 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3469 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3470 let intcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3471 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3472 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3473 throw "x9"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3474 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3475 SetLineNumber two_lines_before_interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3476 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3477 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3478 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3479 let intcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3480 call CHECK(15, "Vim:Interrupt", '',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3481 \ two_lines_before_interrupt + 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3482 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3483 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3484 if !intcaught && $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3485 call CHECK(15)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3486 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3487 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3488 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3489 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3490 call CHECK(16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3491
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3492 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3494 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3495 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3496 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3497 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3498 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3499 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3500 SetLineNumber line_before_throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3501 throw "x10"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3502 " missing endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3503 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3504 call CHECK(17)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3505 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3506 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3507 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3508 call CHECK(18, 'E171', "Missing :endif", line_before_throw + 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3509 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3510 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3511 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3512 call CHECK(18)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3513 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3514 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3515 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3516 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3517 call CHECK(19)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3518
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3519 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3521 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3522 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3523 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3524 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3525 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3526 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3527 SetLineNumber line_before_throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3528 throw "x11"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3529 " missing endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3530 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3531 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3532 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3533 call CHECK(20, 'E171', "Missing :endif", line_before_throw + 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3534 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3535 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3536 if !errcaught && $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3537 call CHECK(20)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3538 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3539 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3540 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3541 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3542 call CHECK(21)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3543
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3544 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3546 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3547
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3548 Xcheck 2038431743
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3551 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3552 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3553 " Test 60: (Re)throwing v:exception; :echoerr. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3554 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3555 " A user exception can be rethrown after catching by throwing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3556 " v:exception. An error or interrupt exception cannot be rethrown
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3557 " because Vim exceptions cannot be faked. A Vim exception using the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3558 " value of v:exception can, however, be triggered by the :echoerr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3559 " command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3560 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3562 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3564 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3565 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3566 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3567 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3568 catch /oops/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3569 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3570 throw v:exception " rethrow user exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3571 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3572 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3573 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3574 catch /^oops$/ " catches rethrown user exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3575 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3576 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3577 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3578 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3580 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3581 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3582 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3583 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3584 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3585 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
3586 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3587 Xout "did_emsg was reset before executing " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3588 \ "BufWritePost autocommands."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3589 catch /^Vim(write):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3590 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3591 throw v:exception " throw error: cannot fake Vim exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3592 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3593 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3594 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3595 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3596 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3597 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3598 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3599 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3600 catch /^Vim(throw):/ " catches throw error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3601 let caught = caught + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3602 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3603 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3604 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3605 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3606 if caught != 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3607 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3608 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3609 elseif caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3610 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3611 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3612 return | " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3613 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3614 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3615 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3616
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3617 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3618 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3619
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3620 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3621 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3622 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3623 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3624 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3625 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3626 catch /^Vim/ " catch error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3627 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3628 " Trigger Vim error exception with value specified after :echoerr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3629 let value = substitute(v:exception, '^Vim\((.*)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3630 echoerr value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3631 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3632 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3633 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3634 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3635 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3636 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3637 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3638 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3639 let value = "Error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3640 echoerr value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3641 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3642 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3643 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3644 catch /^Vim(echoerr):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3645 let caught = caught + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3646 if v:exception !~ value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3647 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3648 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3649 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3650 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3651 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3652 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3653 if caught != 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3654 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3655 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3656 elseif caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3657 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3658 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3659 return | " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3660 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3661 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3662 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3663
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3664 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3665 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3666
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3667 unlet! value caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3668
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3669 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3670 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3671 let errcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3672 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3673 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3674 let intcaught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3675 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3676 catch /^Vim:/ " catch interrupt exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3677 let intcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3678 " Trigger Vim error exception with value specified after :echoerr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3679 echoerr substitute(v:exception, '^Vim\((.*)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3680 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3681 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3682 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3683 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3684 if !intcaught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3685 if !$VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3686 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3687 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3688 echoerr "Interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3689 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3690 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3691 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3692 catch /^Vim(echoerr):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3693 let errcaught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3694 if v:exception !~ "Interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3695 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3696 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3697 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3698 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3699 if !errcaught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3700 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3701 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3702 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3703 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3704
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3705 Xcheck 311511339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3706
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3707
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3708 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3709 " Test 61: Catching interrupt exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3710 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3711 " When an interrupt occurs inside a :try/:endtry region, an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3712 " interrupt exception is thrown and can be caught. Its value is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3713 " "Vim:Interrupt". If the interrupt occurs after an error or a :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3714 " but before a matching :catch is reached, all following :catches of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3715 " that try block are ignored, but the interrupt exception can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3716 " caught by the next surrounding try conditional. An interrupt is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3717 " ignored when there is a previous interrupt that has not been caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3718 " or causes a :finally clause to be executed.
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 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3722
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3723 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3724
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3725 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3726 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3727 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3728 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3729 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3730 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3731 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3732 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3733 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3734 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3735 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3736 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3737 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3738 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3739 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3740 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3741 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3742 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3743 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3744 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3745 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3746 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3747
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3748 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3749 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3750 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3751 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3752 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3753 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3754 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3755 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3756 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3757 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3758 catch /.*/ "INTERRUPT - throw interrupt if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3759 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3760 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3761 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3762 finally "INTERRUPT - throw interrupt if $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3763 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3764 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3765 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3766 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3767 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3768 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3769 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3770 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3771 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3772 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3773 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3774 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3775 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3776 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3777 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3778 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3779 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3780
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3781 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3782 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3783 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3784 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3785 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3786 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3787 throw "x"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3788 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3789 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3790 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3791 catch /x/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3792 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3793 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3794 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3795 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3796 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3797 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3798 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3799 Xpath 524288 " X: 524288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3800 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3801 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3802 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3803 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3804 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3805 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3806 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3807 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3808 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3809 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3810 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3811
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3812 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3813 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3814 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3815 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3816 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3817 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3818 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3819 catch /do_not_catch/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3820 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3821 catch /^Vim:Interrupt$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3822 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3823 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3824 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3825 if caught || $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3826 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3827 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3828 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3829 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3830 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3831 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3832 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3833 break " discard interrupt for $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3834 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3835 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3836
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3839 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3840
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3841 Xcheck 374889517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3843
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3844 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3845 " Test 62: Catching error exceptions {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3846 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3847 " An error inside a :try/:endtry region is converted to an exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3848 " and can be caught. The error exception has a "Vim(cmdname):" prefix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3849 " where cmdname is the name of the failing command, or a "Vim:" prefix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3850 " if no command name is known. The "Vim" prefixes cannot be faked.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3851 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3852
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3853 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3854
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3855 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3856 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3857 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3858 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3859 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3860 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3861 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3862 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3863 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3864 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3865 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3866 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3867 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3868 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3869 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3870 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3871 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3872 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3873
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3874 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3875 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3876 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3877 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3878 unlet novar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3879 catch /^Vim(unlet):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3880 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3881 let v:errmsg = substitute(v:exception, '^Vim(unlet):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3882 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3883 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3884 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3885 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3886 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3887 if !MSG('E108', "No such variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3888 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3889 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3890 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3891 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3892 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3893 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3894 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3895 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3896 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3897 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3898
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3899 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3900 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3901 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3902 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3903 throw novar " error in :throw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3904 catch /^Vim(throw):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3905 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3906 let v:errmsg = substitute(v:exception, '^Vim(throw):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3907 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3908 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3909 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3910 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3911 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3912 if caught ? !MSG('E121', "Undefined variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3913 \ : !MSG('E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3914 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3915 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3916 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3917 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3918 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3919 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3920 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3921 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3922 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3923 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3924
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3925 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3926 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3927 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3928 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3929 throw "Vim:faked" " error: cannot fake Vim exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3930 catch /^Vim(throw):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3931 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3932 let v:errmsg = substitute(v:exception, '^Vim(throw):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3933 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3934 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3935 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3936 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3937 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3938 if !MSG('E608', "Cannot :throw exceptions with 'Vim' prefix")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3939 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3940 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3941 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3942 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3943 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3944 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3945 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3946 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3947 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3948 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3949
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3950 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3951 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3952 " Missing :endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3953 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3955 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3956 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3957 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3958 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3959 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3960 catch /^Vim(endfunction):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3961 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3962 let v:errmsg = substitute(v:exception, '^Vim(endfunction):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3963 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3964 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3965 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3966 Xpath 8192 " 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 if !MSG('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3969 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3970 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3971 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3972 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3973 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3974 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3975 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3976 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3977 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3978 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3980 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3981 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3982 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3983 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3984 ExecAsScript F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3985 catch /^Vim:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3986 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3987 let v:errmsg = substitute(v:exception, '^Vim:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3988 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3989 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3990 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3991 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3992 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3993 if !MSG('E170', "Missing :endwhile")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3994 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3995 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3996 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3997 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3998 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3999 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4000 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4001 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4002 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4003 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4004
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4005 function! G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4006 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4007 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4008
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4009 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4010 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4011 let mfd_save = &mfd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4012 set mfd=3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4013 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4014 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4015 call G()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4016 catch /^Vim(call):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4017 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4018 let v:errmsg = substitute(v:exception, '^Vim(call):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4019 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4020 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4021 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4022 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4023 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4024 if !MSG('E132', "Function call depth is higher than 'maxfuncdepth'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4025 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4026 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4027 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4028 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4029 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4030 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4031 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4032 let &mfd = mfd_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4033 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4034 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4035 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4036
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4037 function! H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4038 return H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4039 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4040
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4041 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4042 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4043 let mfd_save = &mfd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4044 set mfd=3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4045 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4046 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4047 call H()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4048 catch /^Vim(return):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4049 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4050 let v:errmsg = substitute(v:exception, '^Vim(return):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4051 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4052 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4053 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4054 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4055 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4056 if !MSG('E132', "Function call depth is higher than 'maxfuncdepth'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4057 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4058 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4059 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4060 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4061 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4062 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4063 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4064 let &mfd = mfd_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4065 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4066 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4067 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4068
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4069 unlet! caught mfd_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4070 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4071 delfunction G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4072 delfunction H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4073 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4074
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4075 Xcheck 286331153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4076
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4077 " Leave MSG() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4078
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4080 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4081 " Test 63: Suppressing error exceptions by :silent!. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4082 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4083 " A :silent! command inside a :try/:endtry region suppresses the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4084 " conversion of errors to an exception and the immediate abortion on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4085 " error. When the commands executed by the :silent! themselves open
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4086 " a new :try/:endtry region, conversion of errors to exception and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4087 " immediate abortion is switched on again - until the next :silent!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4088 " etc. The :silent! has the effect of setting v:errmsg to the error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4089 " message text (without displaying it) and continuing with the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4090 " script line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4091 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4092 " When a command triggering autocommands is executed by :silent!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4093 " inside a :try/:endtry, the autocommand execution is not suppressed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4094 " on error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4095 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4096 " This test reuses the function MSG() from the previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4097 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4098
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4099 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4101 XloopINIT! 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4103 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4105 function! S(n) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4106 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4107 let g:taken = g:taken . "E" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4108 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4109 exec "asdf" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4111 " Check that ":silent!" continues:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4112 Xloop 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4114 " Check that ":silent!" sets "v:errmsg":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4115 if MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4116 Xloop 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4117 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4118 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4120 function! Foo()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4121 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4122 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4123 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4124 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4125 " This is not silent:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4126 call S(3) " X: 0 * 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4127 catch /^Vim:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4128 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4129 let errmsg3 = substitute(v:exception, '^Vim:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4130 silent! call S(4) " X: 3 * 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4131 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4132 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4133 let errmsg3 = v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4134 " Do call S(4) here if not executed in :catch.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4135 silent! call S(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4136 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4137 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4138 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4139 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4140 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4141 let v:errmsg = errmsg3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4142 if !MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4143 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4144 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4145 silent! call S(5) " X: 3 * 256
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4146 " Break out of try conditionals that cover ":silent!". This also
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4147 " discards the aborting error when $VIMNOERRTHROW is non-zero.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4148 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4149 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4150 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4151 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4152 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4153 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4154 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4155 " This is a double ":silent!" (see caller).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4156 silent! call S(6) " X: 3 * 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4157 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4159 function! Bar()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4160 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4161 silent! call S(2) " X: 3 * 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4162 " X: 3 * 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4163 silent! execute "call Foo() | call S(7)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4164 silent! call S(8) " X: 3 * 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4165 endtry " normal end of try cond that covers ":silent!"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4166 " This has a ":silent!" from the caller:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4167 call S(9) " X: 3 * 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4168 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4169
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4170 silent! call S(1) " X: 3 * 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4171 silent! call Bar()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4172 silent! call S(10) " X: 3 * 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4174 let expected = "E1E2E3E4E5E6E7E8E9E10"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4175 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4176 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4177 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4178 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4179
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4180 augroup TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4181 autocmd BufWritePost * Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4182 augroup END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4184 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4185 write /i/m/p/o/s/s/i/b/l/e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4186 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4188 autocmd! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4189 unlet! caught errmsg3 taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4190 delfunction S
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4191 delfunction Foo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4192 delfunction Bar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4193 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4195 Xcheck 236978127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4198 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4199 " Test 64: Error exceptions after error, interrupt or :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4200 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4201 " When an error occurs after an interrupt or a :throw but before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4202 " a matching :catch is reached, all following :catches of that try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4203 " block are ignored, but the error exception can be caught by the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4204 " surrounding try conditional. Any previous error exception is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4205 " discarded. An error is ignored when there is a previous error that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4206 " has not been caught.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4207 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4209 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4211 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4213 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4214 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4215 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4216 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4217 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4218 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4219 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4220 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4221 endwhile " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4222 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4223 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4224 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4225 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4226 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4227 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4228 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4229 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4230 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4231 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4232 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4233 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4234 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4235 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4236 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4238 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4239 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4240 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4241 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4242 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4243 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4244 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4245 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4246 catch /.*/ " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4247 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4248 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4249 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4250 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4251 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4252 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4253 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4254 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4255 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4256 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4257 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4258 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4259 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4260 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4261 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4262 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4263 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4264 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4265 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4267 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4268 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4269 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4270 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4271 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4272 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4273 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4274 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4275 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4276 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4277 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4278 catch /.*/ " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4279 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4280 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4281 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4282 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4283 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4284 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4285 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4286 Xpath 16384 " X: 16384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4287 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4288 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4289 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4290 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4291 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4292 Xpath 65536 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4293 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4294 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4295 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4296 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4297 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4299 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4300 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4301 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4302 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4303 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4304 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4305 throw "x"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4306 catch /do_not_catch/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4307 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4308 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4309 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4310 catch /x/ " throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4311 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4312 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4313 Xpath 1048576 " 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 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4316 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4317 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4318 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4319 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4320 Xpath 4194304 " X: 4194304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4321 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4322 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4323 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4324 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4325 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4326 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4327 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4328 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4329 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4330
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4331 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4332 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4333 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4334 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4335 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4336 " endif " :endif without :if; throw error exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4337 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4338 " Missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4339 catch /do_not_catch/ " ignore new error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4340 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4341 catch /^Vim(endif):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4342 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4343 catch /^Vim(/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4344 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4345 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4346 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4347 if caught || $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4348 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4349 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4350 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4351 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4352 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4353 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4354 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4355 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4356 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4357 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4358
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4359 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4361 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4363 Xcheck 1499645335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4364
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4366 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4367 " Test 65: Errors in the /pattern/ argument of a :catch {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4368 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4369 " On an error in the /pattern/ argument of a :catch, the :catch does
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4370 " not match. Any following :catches of the same :try/:endtry don't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4371 " match either. Finally clauses are executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4372 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4374 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4375
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4376 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4377 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4378 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4379 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4380 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4381 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4382 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4383 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4384 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4385 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4386 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4387 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4388 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4389 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4390 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4391 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4392 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4393 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4395 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4396 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4397 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4398 throw "oops"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4399 catch /^oops$/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4400 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4401 catch /\)/ " not checked; exception has already been caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4402 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4403 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4404 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4405 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4406 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4407 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4408 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4410 function! F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4411 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4412 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4413 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4414 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4415 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4416 throw "ab"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4417 catch /abc/ " does not catch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4418 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4419 catch /\)/ " error; discards exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4420 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4421 catch /.*/ " not checked
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4422 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4423 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4424 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4425 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4426 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4427 catch /^ab$/ " checked, but original exception is discarded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4428 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4429 catch /^Vim(catch):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4430 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4431 let v:errmsg = substitute(v:exception, '^Vim(catch):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4432 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4433 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4434 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4435 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4436 endif
7977
96fe78b32ad5 commit https://github.com/vim/vim/commit/dc94a26a641914df5f1ba1ab47a5752e1137287e
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
4437 if !MSG('E475', "Invalid argument")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4438 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4439 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4440 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4441 return | " discard error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4442 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4443 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4444 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4445 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4446 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4447 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4448 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4449
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4450 call F()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4451 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4453 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4454 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4455 unlet! caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4457 Xcheck 70187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4458
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4460 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4461 " Test 66: Stop range :call on error, interrupt, or :throw {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4462 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4463 " When a function which is multiply called for a range since it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4464 " doesn't handle the range itself has an error in a command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4465 " dynamically enclosed by :try/:endtry or gets an interrupt or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4466 " executes a :throw, no more calls for the remaining lines in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4467 " range are made. On an error in a command not dynamically enclosed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4468 " by :try/:endtry, the function is executed again for the remaining
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4469 " lines in the range.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4470 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4471
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4472 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4474 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4476 let file = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4477 exec "edit" file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4478
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4479 insert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4480 line 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4481 line 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4482 line 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4483 .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4485 XloopINIT! 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4487 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4488 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
4489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4490 function! F(reason, n) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4491 let g:taken = g:taken . "F" . a:n .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4492 \ substitute(a:reason, '\(\l\).*', '\u\1', "") .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4493 \ "(" . line(".") . ")"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4494
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4495 if a:reason == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4496 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4497 elseif a:reason == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4498 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4499 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4500 elseif a:reason == "throw"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4501 throw "xyz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4502 elseif a:reason == "aborting error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4503 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4504 if g:taken != g:expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4505 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4506 Xout "'taken' is" g:taken "instead of" g:expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4507 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4508 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4509 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4510 call delete(file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4511 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4512 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4513 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4514 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4516 function! G(reason, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4517 let g:taken = g:taken . "G" . a:n .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4518 \ substitute(a:reason, '\(\l\).*', '\u\1', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4519 1,3call F(a:reason, a:n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4520 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4521
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4522 Xpath 8 " X: 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4523 call G("error", 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4524 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4525 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4526 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4527 call G("error", 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4528 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4529 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4530 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4531 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4532 call G("interrupt", 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4533 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4534 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4535 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4536 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4537 call G("throw", 4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4538 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4539 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4540 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4541 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4542 catch /xyz/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4543 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4544 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4545 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4546 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4547 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4548 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4549 call G("aborting error", 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4550 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4551 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4552
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4553 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4554
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4555 Xcheck 5464
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4557
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4558 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4559 " Test 67: :throw across :call command {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4560 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4561 " On a call command, an exception might be thrown when evaluating the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4562 " function name, during evaluation of the arguments, or when the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4563 " function is being executed. The exception can be caught by the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4564 " caller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4565 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4567 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4569 function! THROW(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4570 if a:n == 1
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4571 Xpath 1 " X: 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4572 elseif a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4573 Xpath 2 " X: 2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4574 elseif a:n == 3
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4575 Xpath 4 " X: 4
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4576 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4577 throw a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4578 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4580 function! NAME(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4581 if a:n == 1
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4582 Xpath 8 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4583 elseif a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4584 Xpath 16 " X: 16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4585 elseif a:n == 3
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4586 Xpath 32 " X: 32
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4587 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4588 Xpath 64 " X: 64
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4589 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4590 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4591 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4592
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4593 function! ARG(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4594 if a:n == 1
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4595 Xpath 128 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4596 elseif a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4597 Xpath 256 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4598 elseif a:n == 3
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4599 Xpath 512 " X: 512
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4600 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4601 Xpath 1024 " X: 1024
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4602 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4603 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4604 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4605
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4606 function! F(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4607 if a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4608 Xpath 2048 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4609 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4610 Xpath 4096 " X: 4096
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4611 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4612 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4613
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4614 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4615 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4616 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4617 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4618
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4619 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4620 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4621 Xpath 8192 " X: 8192
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4622 call {NAME(THROW("name", 1), 1)}(ARG(4711, 1), 1)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4623 Xpath 16384 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4624 catch /^name$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4625 Xpath 32768 " X: 32768
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4626 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4627 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4628 Xout "1:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4629 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4630 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4631 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4632 Xout "1:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4633 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4634 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4635 Xpath 65536 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4636 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4637 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4638 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4639 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4640 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4641 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4642
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4643 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4644 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4645 Xpath 131072 " X: 131072
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4646 call {NAME("F", 2)}(ARG(THROW("arg", 2), 2), 2)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4647 Xpath 262144 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4648 catch /^arg$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4649 Xpath 524288 " X: 524288
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4650 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4651 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4652 Xout "2:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4653 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4654 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4655 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4656 Xout "2:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4657 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4658 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4659 Xpath 1048576 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4660 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4661 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4662 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4663 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4664 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4665 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4666
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4667 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4668 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4669 Xpath 2097152 " X: 2097152
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4670 call {NAME("THROW", 3)}(ARG("call", 3), 3)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4671 Xpath 4194304 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4672 catch /^call$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4673 Xpath 8388608 " X: 8388608
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4674 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4675 Xpath 16777216 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4676 Xout "3:" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4677 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4678 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4679 Xout "3:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4680 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4681 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4682 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4683 Xout "3:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4684 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4685 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4686 Xpath 33554432 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4687 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4688 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4689 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4690 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4691 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4692 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4693
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4694 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4695 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4696 Xpath 67108864 " X: 67108864
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4697 call {NAME("F", 4)}(ARG(4711, 4), 4)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4698 Xpath 134217728 " X: 134217728
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4699 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4700 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4701 Xout "4:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4702 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4703 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4704 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4705 Xout "4:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4706 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4707 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4708 Xpath 268435456 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4709 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4710 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4711 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4712 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4713 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4714 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4715
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4716 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4717 Xpath 536870912 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4718 Xout v:throwpoint
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4719 catch /.*/
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4720 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4721 Xout v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4722 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4723 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4724 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4725 Xout v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4726 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4727 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4728 Xpath 1073741824 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4729 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4730 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4731 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4732 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4733
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4734 unlet error
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4735 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4736
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4737 Xcheck 212514423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4739 " Leave THROW(), NAME(), and ARG() for the next test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4741
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4742 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4743 " Test 68: :throw across function calls in expressions {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4744 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4745 " On a function call within an expression, an exception might be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4746 " thrown when evaluating the function name, during evaluation of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4747 " arguments, or when the function is being executed. The exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4748 " can be caught by the caller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4749 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4750 " This test reuses the functions THROW(), NAME(), and ARG() from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4751 " previous test.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4752 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4753
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4754 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4756 function! F(x, n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4757 if a:n == 2
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4758 Xpath 2048 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4759 elseif a:n == 4
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4760 Xpath 4096 " X: 4096
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4761 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4762 return a:x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4763 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4764
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4765 unlet! var1 var2 var3 var4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4766
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4767 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4768 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4769 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4770 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4771
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4772 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4773 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4774 Xpath 8192 " X: 8192
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4775 let var1 = {NAME(THROW("name", 1), 1)}(ARG(4711, 1), 1)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4776 Xpath 16384 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4777 catch /^name$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4778 Xpath 32768 " X: 32768
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4779 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4780 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4781 Xout "1:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4782 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4783 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4784 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4785 Xout "1:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4786 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4787 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4788 Xpath 65536 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4789 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4790 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4791 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4792 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4793 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4794 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4795
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4796 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4797 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4798 Xpath 131072 " X: 131072
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4799 let var2 = {NAME("F", 2)}(ARG(THROW("arg", 2), 2), 2)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4800 Xpath 262144 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4801 catch /^arg$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4802 Xpath 524288 " X: 524288
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4803 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4804 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4805 Xout "2:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4806 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4807 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4808 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4809 Xout "2:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4810 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4811 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4812 Xpath 1048576 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4813 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4814 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4815 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4816 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4817 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4818 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4819
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4820 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4821 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4822 Xpath 2097152 " X: 2097152
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4823 let var3 = {NAME("THROW", 3)}(ARG("call", 3), 3)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4824 Xpath 4194304 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4825 catch /^call$/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4826 Xpath 8388608 " X: 8388608
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4827 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4828 Xpath 16777216 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4829 Xout "3:" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4830 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4831 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4832 Xout "3:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4833 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4834 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4835 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4836 Xout "3:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4837 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4838 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4839 Xpath 33554432 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4840 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4841 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4842 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4843 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4844 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4845 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4846
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4847 while 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4848 try
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4849 Xpath 67108864 " X: 67108864
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4850 let var4 = {NAME("F", 4)}(ARG(4711, 4), 4)
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4851 Xpath 134217728 " X: 134217728
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4852 catch /.*/
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4853 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4854 Xout "4:" v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4855 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4856 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4857 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4858 Xout "4:" v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4859 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4860 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4861 Xpath 268435456 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4862 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4863 let error = 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4864 let v:errmsg = ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4865 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4866 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4867 endwhile
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4868
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4869 catch /^0$/ " default return value
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4870 Xpath 536870912 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4871 Xout v:throwpoint
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4872 catch /.*/
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4873 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4874 Xout v:exception "in" v:throwpoint
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4875 finally
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4876 if !error && $VIMNOERRTHROW && v:errmsg != ""
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4877 let error = 1
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4878 Xout v:errmsg
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4879 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4880 if error
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4881 Xpath 1073741824 " X: 0
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4882 endif
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4883 break " discard error for $VIMNOERRTHROW
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4884 endtry
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4885 endwhile
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4886
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4887 if exists("var1") || exists("var2") || exists("var3") ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4888 \ !exists("var4") || var4 != 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4889 " The Xpath command does not accept 2^31 (negative); add explicitly:
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4890 let Xpath = Xpath + 2147483648 " X: 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4891 if exists("var1")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4892 Xout "var1 =" var1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4893 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4894 if exists("var2")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4895 Xout "var2 =" var2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4896 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4897 if exists("var3")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4898 Xout "var3 =" var3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4899 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4900 if !exists("var4")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4901 Xout "var4 unset"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4902 elseif var4 != 4711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4903 Xout "var4 =" var4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4904 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4905 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4906
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4907 unlet! error var1 var2 var3 var4
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4908 delfunction THROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4909 delfunction NAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4910 delfunction ARG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4911 delfunction F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4913 Xcheck 212514423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4914
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
4915 " Tests 69 to 75 were moved to test_trycatch.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
4916 let Xtest = 76
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4917
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4918
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4919 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
4920 " Test 76: Errors, interrupts, :throw during expression evaluation {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4921 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4922 " When a function call made during expression evaluation is aborted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4923 " due to an error inside a :try/:endtry region or due to an interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4924 " or a :throw, the expression evaluation is aborted as well. No
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4925 " message is displayed for the cancelled expression evaluation. On an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4926 " error not inside :try/:endtry, the expression evaluation continues.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4927 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4928
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4929 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4930
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4931 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4932
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4933 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4934
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4935 function! ERR(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4936 let g:taken = g:taken . "E" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4937 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4938 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4939
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4940 function! ERRabort(n) abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4941 let g:taken = g:taken . "A" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4942 asdf
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4943 endfunction " returns -1; may cause follow-up msg for illegal var/func name
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4944
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4945 function! WRAP(n, arg)
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4946 let g:taken = g:taken . "W" . a:n
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4947 let g:saved_errmsg = v:errmsg
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4948 return arg
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4949 endfunction
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4950
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4951 function! INT(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4952 let g:taken = g:taken . "I" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4953 "INTERRUPT9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4954 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4955 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4956
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4957 function! THR(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4958 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4959 throw "should not be caught"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4960 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4961
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4962 function! CONT(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4963 let g:taken = g:taken . "C" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4964 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4965
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4966 function! MSG(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4967 let g:taken = g:taken . "M" . a:n
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4968 let errmsg = (a:n >= 37 && a:n <= 44) ? g:saved_errmsg : v:errmsg
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4969 let msgptn = (a:n >= 10 && a:n <= 27) ? "^$" : "asdf"
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4970 if errmsg !~ msgptn
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4971 let g:taken = g:taken . "x"
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4972 Xout "Expr" a:n.": Unexpected message:" v:errmsg
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4973 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4974 let v:errmsg = ""
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
4975 let g:saved_errmsg = ""
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4976 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4978 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4980 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4981 let t = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4982 XloopINIT 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4983 while t <= 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4984 Xloop 1 " X: 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4985 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4986 if t == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4987 let v{ERR(t) + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4988 elseif t == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4989 let v{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4990 elseif t == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4991 let var = exists('v{ERR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4992 elseif t == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4993 unlet v{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4994 elseif t == 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4995 function F{ERR(t) + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4996 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4997 elseif t == 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4998 function F{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4999 elseif t == 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5000 let var = exists('*F{ERR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5001 elseif t == 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5002 delfunction F{ERR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5003 elseif t == 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5004 let var = ERR(t) + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5005 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5006 catch /asdf/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5007 " v:errmsg is not set when the error message is converted to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5008 " exception. Set it to the original error message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5009 let v:errmsg = substitute(v:exception, '^Vim:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5010 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5011 " An error exception has been thrown after the original error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5012 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5013 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5014 call MSG(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5015 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5016 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5017 continue " discard an aborting error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5018 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5019 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5020 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5021 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5022 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5023 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5025 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5026 let t = 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5027 XloopINIT 1024 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5028 while t <= 18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5029 Xloop 1 " X: 1024 * 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5030 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5031 if t == 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5032 let v{INT(t) + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5033 elseif t == 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5034 let v{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5035 elseif t == 12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5036 let var = exists('v{INT(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5037 elseif t == 13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5038 unlet v{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5039 elseif t == 14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5040 function F{INT(t) + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5041 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5042 elseif t == 15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5043 function F{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5044 elseif t == 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5045 let var = exists('*F{INT(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5046 elseif t == 17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5047 delfunction F{INT(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5048 elseif t == 18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5049 let var = INT(t) + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5050 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5051 catch /^Vim\((\a\+)\)\=:\(Interrupt\)\@!/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5052 " An error exception has been triggered after the interrupt.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5053 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5054 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5055 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5056 call MSG(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5057 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5058 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5059 continue " discard interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5060 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5061 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5062 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5063 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5064 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5065 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5066
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5067 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5068 let t = 19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5069 XloopINIT 1048576 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5070 while t <= 27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5071 Xloop 1 " X: 1048576 * 511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5072 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5073 if t == 19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5074 let v{THR(t) + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5075 elseif t == 20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5076 let v{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5077 elseif t == 21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5078 let var = exists('v{THR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5079 elseif t == 22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5080 unlet v{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5081 elseif t == 23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5082 function F{THR(t) + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5083 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5084 elseif t == 24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5085 function F{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5086 elseif t == 25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5087 let var = exists('*F{THR(t) + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5088 elseif t == 26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5089 delfunction F{THR(t) + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5090 elseif t == 27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5091 let var = THR(t) + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5092 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5093 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5094 " An error exception has been triggered after the :throw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5095 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5096 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5097 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5098 call MSG(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5099 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5100 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5101 continue " discard exception
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5102 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5103 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5104 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5105 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5106 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5107 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5109 let v{ERR(28) + CONT(28)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5110 call MSG(28)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5111 let v{ERR(29) + CONT(29)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5112 call MSG(29)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5113 let var = exists('v{ERR(30) + CONT(30)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5114 call MSG(30)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5115 unlet v{ERR(31) + CONT(31)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5116 call MSG(31)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5117 function F{ERR(32) + CONT(32)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5118 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5119 call MSG(32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5120 function F{ERR(33) + CONT(33)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5121 call MSG(33)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5122 let var = exists('*F{ERR(34) + CONT(34)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5123 call MSG(34)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5124 delfunction F{ERR(35) + CONT(35)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5125 call MSG(35)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5126 let var = ERR(36) + CONT(36)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5127 call MSG(36)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5128
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5129 let saved_errmsg = ""
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5130
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5131 let v{WRAP(37, ERRabort(37)) + CONT(37)} = 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5132 call MSG(37)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5133 let v{WRAP(38, ERRabort(38)) + CONT(38)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5134 call MSG(38)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5135 let var = exists('v{WRAP(39, ERRabort(39)) + CONT(39)}')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5136 call MSG(39)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5137 unlet v{WRAP(40, ERRabort(40)) + CONT(40)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5138 call MSG(40)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5139 function F{WRAP(41, ERRabort(41)) + CONT(41)}()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5140 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5141 call MSG(41)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5142 function F{WRAP(42, ERRabort(42)) + CONT(42)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5143 call MSG(42)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5144 let var = exists('*F{WRAP(43, ERRabort(43)) + CONT(43)}')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5145 call MSG(43)
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5146 delfunction F{WRAP(44, ERRabort(44)) + CONT(44)}
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5147 call MSG(44)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5148 let var = ERRabort(45) + CONT(45)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5149 call MSG(45)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5151 Xpath 1073741824 " X: 1073741824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5153 let expected = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5154 \ . "E1M1E2M2E3M3E4M4E5M5E6M6E7M7E8M8E9M9"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5155 \ . "I10M10I11M11I12M12I13M13I14M14I15M15I16M16I17M17I18M18"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5156 \ . "T19M19T20M20T21M21T22M22T23M23T24M24T25M25T26M26T27M27"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5157 \ . "E28C28M28E29C29M29E30C30M30E31C31M31E32C32M32E33C33M33"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5158 \ . "E34C34M34E35C35M35E36C36M36"
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5159 \ . "A37W37C37M37A38W38C38M38A39W39C39M39A40W40C40M40A41W41C41M41"
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5160 \ . "A42W42C42M42A43W43C43M43A44W44C44M44A45C45M45"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5162 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5163 " The Xpath command does not accept 2^31 (negative); display explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5164 exec "!echo 2147483648 >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5165 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5166 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5167 if substitute(taken,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5168 \ '\(.*\)E3C3M3x\(.*\)E30C30M30x\(.*\)A39C39M39x\(.*\)',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5169 \ '\1E3M3\2E30C30M30\3A39C39M39\4',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5170 \ "") == expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5171 Xout "Is ++emsg_skip for var with expr_start non-NULL"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5172 \ "in f_exists ok?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5173 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5174 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5175
341
b516a9f9d603 updated for version 7.0088
vimboss
parents: 336
diff changeset
5176 unlet! v var saved_errmsg taken expected
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5177 call delete(WA_t5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5178 call delete(WA_t14)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5179 call delete(WA_t23)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5180 unlet! WA_t5 WA_t14 WA_t23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5181 delfunction WA_t5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5182 delfunction WA_t14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5183 delfunction WA_t23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5185 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5186
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5187 Xcheck 1610087935
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5190 "-------------------------------------------------------------------------------
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
5191 " Test 77: Errors, interrupts, :throw in name{brace-expression} {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5192 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5193 " When a function call made during evaluation of an expression in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5194 " braces as part of a function name after ":function" is aborted due
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5195 " to an error inside a :try/:endtry region or due to an interrupt or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5196 " a :throw, the expression evaluation is aborted as well, and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5197 " function definition is ignored, skipping all commands to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5198 " ":endfunction". On an error not inside :try/:endtry, the expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5199 " evaluation continues and the function gets defined, and can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5200 " called and deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5201 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5203 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5205 XloopINIT 1 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5207 function! ERR() abort
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5208 Xloop 1 " X: 1 + 4 + 16 + 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5209 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5210 endfunction " returns -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5211
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5212 function! OK()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5213 Xloop 2 " X: 2 * (1 + 4 + 16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5214 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5215 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5216 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5218 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5220 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5221 function! F{1 + ERR() + OK()}(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5222 " F0 should be defined.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5223 if exists("a:arg") && a:arg == "calling"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5224 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5225 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5226 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5227 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5228 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5229 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5230 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5231 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5232 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5234 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5235 call F{1 + ERR() + OK()}("calling")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5236 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5237 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5238 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5239 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5241 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5242 delfunction F{1 + ERR() + OK()}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5243 if v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5244 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5245 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5246 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5248 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5249 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5250 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5251 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5252 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5253 function! G{1 + ERR() + OK()}(arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5254 " G0 should not be defined, and the function body should be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5255 " skipped.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5256 if exists("a:arg") && a:arg == "calling"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5257 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5258 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5259 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5260 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5261 " Use an unmatched ":finally" to check whether the body is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5262 " skipped when an error occurs in ERR(). This works whether or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5263 " not the exception is converted to an exception.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5264 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5265 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5266 Xout "Body of G{1 + ERR() + OK()}() not skipped"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5267 " Discard the aborting error or exception, and break the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5268 " while loop.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5269 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5270 " End the try conditional and start a new one to avoid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5271 " ":catch after :finally" errors.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5272 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5273 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5274 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5275 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5277 " When the function was not defined, this won't be reached - whether
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5278 " the body was skipped or not. When the function was defined, it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5279 " can be called and deleted here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5280 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5281 Xout "G0() has been defined"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5282 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5283 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5284 call G{1 + ERR() + OK()}("calling")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5285 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5286 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5287 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5288 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5289 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5290 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5291 delfunction G{1 + ERR() + OK()}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5292 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5293 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5294 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5295 catch /asdf/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5296 " Jumped to when the function is not defined and the body is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5297 " skipped.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5298 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5299 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5300 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5301 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5302 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5303 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5304 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5305 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5306 endtry " jumped to when the body is not skipped
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5307 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5308 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5309 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5310 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5311 Xout "Body of G{1 + ERR() + OK()}() not skipped, exception caught"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5312 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5313 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5315 Xcheck 1388671
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5317
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5318 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5319 " Test 78: Messages on parsing errors in expression evaluation {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5320 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5321 " When an expression evaluation detects a parsing error, an error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5322 " message is given and converted to an exception, and the expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5323 " evaluation is aborted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5324 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5325
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5326 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5327
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5328 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5330 let taken = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5332 function! F(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5333 let g:taken = g:taken . "F" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5334 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5336 function! MSG(n, enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5337 let g:taken = g:taken . "M" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5338 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5339 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5340 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5341 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5342 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5343 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5344 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5345 Xout "Expr" a:n.": Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5346 let g:taken = g:taken . "x"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5347 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5348 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5349 Xout "Expr" a:n.": Unexpected message:" v:errmsg
119
e8f07016e34d updated for version 7.0042
vimboss
parents: 108
diff changeset
5350 Xout "Expected: " . a:enr . ': ' . a:emsg
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5351 let g:taken = g:taken . "X"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5352 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5353 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5354 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5356 function! CONT(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5357 let g:taken = g:taken . "C" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5358 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5359
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5360 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5361 XloopINIT 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5363 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5364 let t = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5365 while t <= 14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5366 let g:taken = g:taken . "T" . t
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5367 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5368 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5369 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5370 if t == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5371 let v{novar + CONT(t)} = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5372 elseif t == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5373 let v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5374 elseif t == 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5375 let var = exists('v{novar + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5376 elseif t == 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5377 unlet v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5378 elseif t == 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5379 function F{novar + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5380 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5381 elseif t == 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5382 function F{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5383 elseif t == 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5384 let var = exists('*F{novar + CONT(t)}')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5385 elseif t == 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5386 delfunction F{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5387 elseif t == 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5388 echo novar + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5389 elseif t == 10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5390 echo v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5391 elseif t == 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5392 echo F{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5393 elseif t == 12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5394 let var = novar + CONT(t)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5395 elseif t == 13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5396 let var = v{novar + CONT(t)}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5397 elseif t == 14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5398 let var = F{novar + CONT(t)}()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5399 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5400 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5401 " v:errmsg is not set when the error message is converted to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5402 " exception. Set it to the original error message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5403 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5404 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5405 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5406 finally
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
5407 if t <= 8 && t != 3 && t != 7
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
5408 call MSG(t, 'E475', 'Invalid argument\>')
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
5409 else
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
5410 if !caught " no error exceptions ($VIMNOERRTHROW set)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5411 call MSG(t, 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5412 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5413 call MSG(t, 'E121', "Undefined variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5414 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5415 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5416 let t = t + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5417 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5418 continue " discard an aborting error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5419 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5420 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5421 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5422 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5423 Xout t.":" v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5424 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5426 function! T(n, expr, enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5427 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5428 let g:taken = g:taken . "T" . a:n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5429 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5430 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5431 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5432 execute "let var = " . a:expr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5433 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5434 " v:errmsg is not set when the error message is converted to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5435 " exception. Set it to the original error message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5436 let v:errmsg = substitute(v:exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5437 \ '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5438 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5439 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5440 if !caught " no error exceptions ($VIMNOERRTHROW set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5441 call MSG(a:n, 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5442 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5443 call MSG(a:n, a:enr, a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5444 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5445 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5446 " Discard an aborting error:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5447 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5448 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5449 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5450 Xloop 1 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5451 Xout a:n.":" v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5452 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5453 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5454
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5455 call T(15, 'Nofunc() + CONT(15)', 'E117', "Unknown function")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5456 call T(16, 'F(1 2 + CONT(16))', 'E116', "Invalid arguments")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5457 call T(17, 'F(1, 2) + CONT(17)', 'E118', "Too many arguments")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5458 call T(18, 'F() + CONT(18)', 'E119', "Not enough arguments")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5459 call T(19, '{(1} + CONT(19)', 'E110', "Missing ')'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5460 call T(20, '("abc"[1) + CONT(20)', 'E111', "Missing ']'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5461 call T(21, '(1 +) + CONT(21)', 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5462 call T(22, '1 2 + CONT(22)', 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5463 call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5464 call T(24, '("abc) + CONT(24)', 'E114', "Missing quote")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5465 call T(25, "('abc) + CONT(25)", 'E115', "Missing quote")
102
0aa0e89bfd5f updated for version 7.0039
vimboss
parents: 95
diff changeset
5466 call T(26, '& + CONT(26)', 'E112', "Option name missing")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5467 call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5469 Xpath 134217728 " X: 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5470
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5471 let expected = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5472 \ . "T1M1T2M2T3M3T4M4T5M5T6M6T7M7T8M8T9M9T10M10T11M11T12M12T13M13T14M14"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5473 \ . "T15M15T16M16T17M17T18M18T19M19T20M20T21M21T22M22T23M23T24M24T25M25"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5474 \ . "T26M26T27M27"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5476 if taken != expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5477 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5478 Xout "'taken' is" taken "instead of" expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5479 if substitute(taken, '\(.*\)T3M3x\(.*\)', '\1T3M3\2', "") == expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5480 Xout "Is ++emsg_skip for var with expr_start non-NULL"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5481 \ "in f_exists ok?"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5482 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5483 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5485 unlet! var caught taken expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5486 call delete(WA_t5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5487 unlet! WA_t5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5488 delfunction WA_t5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5490 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5491
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5492 Xcheck 134217728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5494
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5495 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5496 " Test 79: Throwing one of several errors for the same command {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5497 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5498 " When several errors appear in a row (for instance during expression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5499 " evaluation), the first as the most specific one is used when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5500 " throwing an error exception. If, however, a syntax error is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5501 " detected afterwards, this one is used for the error exception.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5502 " On a syntax error, the next command is not executed, on a normal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5503 " error, however, it is (relevant only in a function without the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5504 " "abort" flag). v:errmsg is not set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5505 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5506 " If throwing error exceptions is configured off, v:errmsg is always
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5507 " set to the latest error message, that is, to the more general
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5508 " message or the syntax error, respectively.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5509 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5511 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5513 XloopINIT 1 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5514
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5515 function! NEXT(cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5516 exec a:cmd . " | Xloop 1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5517 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5518
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5519 call NEXT('echo novar') " X: 1 * 1 (checks nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5520 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5521 call NEXT('let novar #') " X: 0 * 2 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5522 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5523 call NEXT('unlet novar #') " X: 0 * 4 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5524 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5525 call NEXT('let {novar}') " X: 0 * 8 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5526 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5527 call NEXT('unlet{ novar}') " X: 0 * 16 (skips nextcmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5528
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5529 function! EXEC(cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5530 exec a:cmd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5531 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5532
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5533 function! MATCH(expected, msg, enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5534 let msg = a:msg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5535 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5536 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5537 let msg = ":" . msg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5538 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5539 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5540 if msg !~ '^'.a:enr.':' || (english && msg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5541 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5542 if a:expected " no match although expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5543 if a:msg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5544 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5545 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5546 let msg = escape(msg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5547 Xout "Unexpected message:" msg
108
375b1d0f97b0 updated for version 7.0040
vimboss
parents: 102
diff changeset
5548 Xout "Expected:" a:enr . ": " . a:emsg
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5549 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5550 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5551 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5552 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5553 if !a:expected " match although not expected
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5554 let msg = escape(msg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5555 Xout "Unexpected message:" msg
108
375b1d0f97b0 updated for version 7.0040
vimboss
parents: 102
diff changeset
5556 Xout "Expected none."
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5557 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5558 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5559 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5560 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5562 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5564 while 1 " dummy loop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5565 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5566 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5567 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5568 let thrmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5569 call EXEC('echo novar') " normal error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5570 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5571 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5572 let thrmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5573 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5574 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5575 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5576 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5577 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5578 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5579 elseif !MATCH(1, thrmsg, 'E121', "Undefined variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5580 \ || v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5581 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5582 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5583 if !caught && !MATCH(1, v:errmsg, 'E15', "Invalid expression")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5584 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5585 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5586 break " discard error if $VIMNOERRTHROW == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5587 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5588 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5589
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5590 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5591 let cmd = "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5592 XloopINIT 1024 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5593 while cmd != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5594 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5595 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5596 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5597 let thrmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5598 call EXEC(cmd . ' novar #') " normal plus syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5599 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5600 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5601 let thrmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5602 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5603 Xloop 1 " X: 1024 * (1 + 32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5604 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5605 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5606 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5607 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5608 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5609 if cmd == "let"
2591
88095f75d63b updated for version 7.3.015
Bram Moolenaar <bram@vim.org>
parents: 849
diff changeset
5610 let match = MATCH(0, thrmsg, 'E121', "Undefined variable")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5611 elseif cmd == "unlet"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5612 let match = MATCH(0, thrmsg, 'E108', "No such variable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5613 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5614 if match " normal error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5615 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5616 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5617 if !MATCH(1, thrmsg, 'E488', "Trailing characters")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5618 \|| v:errmsg != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5619 " syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5620 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5621 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5622 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5623 if !caught && !MATCH(1, v:errmsg, 'E488', "Trailing characters")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5624 " last error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5625 Xloop 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5626 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5627 if cmd == "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5628 let cmd = "unlet"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5629 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5630 let cmd = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5631 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5632 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5633 continue " discard error if $VIMNOERRTHROW == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5634 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5635 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5637 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5638 let cmd = "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5639 XloopINIT 2097152 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5640 while cmd != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5641 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5642 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5643 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5644 let thrmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5645 call EXEC(cmd . ' {novar}') " normal plus syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5646 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5647 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5648 let thrmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5649 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5650 Xloop 1 " X: 2097152 * (1 + 32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5651 if !caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5652 if !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5653 Xloop 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5654 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5655 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5656 if MATCH(0, thrmsg, 'E121', "Undefined variable") " normal error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5657 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5658 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5659 if !MATCH(1, thrmsg, 'E475', 'Invalid argument\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5660 \ || v:errmsg != "" " syntax error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5661 Xloop 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5662 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5663 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5664 if !caught && !MATCH(1, v:errmsg, 'E475', 'Invalid argument\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5665 " last error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5666 Xloop 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5667 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5668 if cmd == "let"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5669 let cmd = "unlet"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5670 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5671 let cmd = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5672 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5673 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5674 continue " discard error if $VIMNOERRTHROW == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5675 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5676 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5678 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5679 " The Xpath command does not accept 2^31 (negative); add explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5680 let Xpath = Xpath + 2147483648 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5681 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5682 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5683
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5684 unlet! next_command thrmsg match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5685 delfunction NEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5686 delfunction EXEC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5687 delfunction MATCH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5688
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5689 Xcheck 70288929
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5690
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5691
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5692 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5693 " Test 80: Syntax error in expression for illegal :elseif {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5694 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5695 " If there is a syntax error in the expression after an illegal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5696 " :elseif, an error message is given (or an error exception thrown)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5697 " for the illegal :elseif rather than the expression error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5698 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5699
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5700 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5702 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5703 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5704 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5705 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5706 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5707 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5708 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5709 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5710 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5711 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5712 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5713 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5714 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5715 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5716 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5717 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5718 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5719 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5721 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5722 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5723 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5724 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5725 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5726 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5727 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5728 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5729 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5730
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5731 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5732 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5733 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5734 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5735 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5736 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5737 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5738 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5739 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5741 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5742 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5743 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5744 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5745 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5746 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5747
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5748 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5749 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5750 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5751 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5752 Xpath 64 " X: 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5753 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5754 Xpath 128 " 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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5757 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5758 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5759 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5760 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5761 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5762 if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5763 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5764 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5765 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5766 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5767 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5768 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5769 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5770 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5771 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5772 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5773 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5774 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5775 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5776 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5777 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5778 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5779 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5780 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5781 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5782 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5783 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5784 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5786 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5787 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5788 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5789 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5790 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5791 if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5792 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5793 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5794 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5795 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5796 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5797 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5798 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5799 Xpath 4096 " X: 4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5800 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5801 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5802 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5803 if !MSG('E584', ":elseif after :else")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5804 Xpath 16384 " 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 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5807 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5808 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5809 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5810 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5811 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5812 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5813 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5814
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5815 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5816 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5817 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5818 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5819 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5820 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5821 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5822 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5823 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5824 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5825 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5826 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5827 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5828 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5829 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5830 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5831 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5832 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5833 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5834 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5835 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5836 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5837 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5838 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5839 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5840
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5841 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5842 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5843 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5844 let v:errmsg = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5845 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5846 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5847 elseif 1 ||| 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5848 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5849 catch /^Vim\((\a\+)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5850 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5851 let v:errmsg = substitute(v:exception, '^Vim\((\a\+)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5852 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5853 Xpath 1048576 " X: 1048576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5854 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5855 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5856 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5857 if !MSG('E582', ":elseif without :if")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5858 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5859 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5860 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5861 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5862 Xpath 8388608 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5863 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5864 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5865 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5866 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5867 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5869 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5870
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5871 unlet! caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5872 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5873
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5874 Xcheck 17895765
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5875
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 " Test 81: Discarding exceptions after an error or interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5879 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5880 " When an exception is thrown from inside a :try conditional without
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5881 " :catch and :finally clauses and an error or interrupt occurs before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5882 " the :endtry is reached, the exception is discarded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5883 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5884
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5885 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5886
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5887 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5888 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5889 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5890 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5891 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5892 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5893 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5894 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5895 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5896 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5897 endtry
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 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5900 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5901 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5902 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5903 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5905 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5906 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5907 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5908 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5909 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5910 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5911 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5912 endtry " INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5913 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5914 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5915 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5916 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5917 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5918 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5919
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5920 Xcheck 387
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5921
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5923 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5924 " Test 82: Ignoring :catch clauses after an error or interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5925 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5926 " When an exception is thrown and an error or interrupt occurs before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5927 " the matching :catch clause is reached, the exception is discarded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5928 " and the :catch clause is ignored (also for the error or interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5929 " exception being thrown then).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5930 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5931
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5932 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5933
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5934 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5935 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5936 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5937 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5938 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5939 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5940 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5941 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5942 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5943 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5944 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5945 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5946 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5947 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5948 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5949 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5950 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5951 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5952 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5953 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5954 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5955 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5956
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5957 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5958 function! E()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5959 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5960 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5961 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5962 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5963 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5964 " if 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5965 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5966 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5967 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5968 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5969 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5970 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5971 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5972 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5973 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5974 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5975 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5976 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5977 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5978 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5980 call E()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5981 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5982 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5983
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5984 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5985 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5986 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5987 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5988 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5989 Xpath 131072 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5990 catch /.*/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5991 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5992 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5993 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5994 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5995 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5996 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5997 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5998 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5999 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6000 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6001 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6002 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6004 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6005 function I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6006 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6007 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6008 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6009 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6010 Xpath 16777216 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6011 catch /.*/ "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6012 Xpath 33554432 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6013 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6014 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6015 Xpath 67108864 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6016 Xout v:exception "in" ExtraVimThrowpoint()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6017 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6018 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6019 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6020 Xpath 268435456 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6021 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6022 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6024 call I()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6025 Xpath 536870912 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6026 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6027
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6028 Xcheck 8454401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6029
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6030
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6031 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6032 " Test 83: Executing :finally clauses after an error or interrupt {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6033 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6034 " When an exception is thrown and an error or interrupt occurs before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6035 " the :finally of the innermost :try is reached, the exception is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6036 " discarded and the :finally clause is executed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6037 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6038
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6039 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6040
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6041 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6042 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6043 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6044 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6045 Xpath 2 " X: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6046 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6047 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6048 " if 1
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 " error after :throw: missing :endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6051 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6052 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6053 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6054 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6055 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6056 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6057 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6058 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6059 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6060
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6061 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6062 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6063 Xpath 256 " X: 256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6064 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6065 Xpath 512 " X: 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6066 throw "arrgh"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6067 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6068 finally "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6069 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6070 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6071 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6072 catch /arrgh/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6073 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6074 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6075 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6076 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6077
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6078 Xcheck 2835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6080
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6081 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6082 " Test 84: Exceptions in autocommand sequences. {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6083 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6084 " When an exception occurs in a sequence of autocommands for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6085 " a specific event, the rest of the sequence is not executed. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6086 " command that triggered the autocommand execution aborts, and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6087 " exception is propagated to the caller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6088 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6089 " For the FuncUndefined event under a function call expression or
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 270
diff changeset
6090 " :call command, the function is not executed, even when it has
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6091 " been defined by the autocommands before the exception occurred.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6092 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6094 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6096 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6097
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6098 function! INT()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6099 "INTERRUPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6100 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6101 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6103 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6104 autocmd!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6106 autocmd User x1 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6107 autocmd User x1 throw "x1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6108 autocmd User x1 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6110 autocmd User x2 Xpath 4 " X: 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6111 autocmd User x2 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6112 autocmd User x2 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6114 autocmd User x3 Xpath 16 " X: 16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6115 autocmd User x3 call INT()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6116 autocmd User x3 Xpath 32 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6118 autocmd FuncUndefined U1 function! U1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6119 autocmd FuncUndefined U1 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6120 autocmd FuncUndefined U1 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6121 autocmd FuncUndefined U1 Xpath 128 " X: 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6122 autocmd FuncUndefined U1 throw "U1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6123 autocmd FuncUndefined U1 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6125 autocmd FuncUndefined U2 function! U2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6126 autocmd FuncUndefined U2 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6127 autocmd FuncUndefined U2 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6128 autocmd FuncUndefined U2 Xpath 1024 " X: 1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6129 autocmd FuncUndefined U2 ASDF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6130 autocmd FuncUndefined U2 Xpath 2048 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6132 autocmd FuncUndefined U3 function! U3()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6133 autocmd FuncUndefined U3 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6134 autocmd FuncUndefined U3 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6135 autocmd FuncUndefined U3 Xpath 8192 " X: 8192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6136 autocmd FuncUndefined U3 call INT()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6137 autocmd FuncUndefined U3 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6138 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6140 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6141 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6142 Xpath 32768 " X: 32768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6143 doautocmd User x1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6144 catch /x1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6145 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6146 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6148 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6149 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6150 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6151 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6152 doautocmd User x2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6153 catch /asdf/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6154 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6155 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6156 Xpath 262144 " X: 262144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6157 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6158 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6159 " Propagate uncaught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6160 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6161 " ... but break loop for caught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6162 " or discard error and break loop if $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6163 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6164 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6165 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6166 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6168 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6169 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6170 Xpath 1048576 " X: 1048576
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 doautocmd User x3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6173 catch /Vim:Interrupt/
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 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6176 Xpath 2097152 " X: 2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6177 if !caught && !$VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6178 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6179 " Propagate uncaught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6180 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6181 " ... but break loop for caught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6182 " or discard interrupt and break loop if $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6183 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6184 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6185 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6186 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6188 if exists("*U1") | delfunction U1 | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6189 if exists("*U2") | delfunction U2 | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6190 if exists("*U3") | delfunction U3 | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6192 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6193 Xpath 8388608 " X: 8388608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6194 call U1()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6195 catch /U1/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6196 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6197 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6199 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6200 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6201 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6202 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6203 call U2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6204 catch /ASDF/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6205 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6206 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6207 Xpath 67108864 " X: 67108864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6208 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6209 Xpath 134217728 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6210 " Propagate uncaught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6211 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6212 " ... but break loop for caught error exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6213 " or discard error and break loop if $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6214 break
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 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6219 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6220 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6221 Xpath 268435456 " X: 268435456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6222 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6223 call U3()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6224 catch /Vim:Interrupt/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6225 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6226 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6227 Xpath 536870912 " X: 536870912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6228 if !caught && !$VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6229 Xpath 1073741824 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6230 " Propagate uncaught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6231 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6232 " ... but break loop for caught interrupt exception,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6233 " or discard interrupt and break loop if $VIMNOINTTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6234 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6235 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6236 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6237 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6238 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6239 " The Xpath command does not accept 2^31 (negative); display explicitly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6240 exec "!echo 2147483648 >>" . g:ExtraVimResult
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6241 Xout "Caught" v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6242 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6244 unlet caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6245 delfunction INT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6246 delfunction U1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6247 delfunction U2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6248 delfunction U3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6249 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6250 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6251 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6253 Xcheck 934782101
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 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6257 " Test 85: Error exceptions in autocommands for I/O command events {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6258 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6259 " When an I/O command is inside :try/:endtry, autocommands to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6260 " executed after it should be skipped on an error (exception) in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6261 " command itself or in autocommands to be executed before the command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6262 " In the latter case, the I/O command should not be executed either.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6263 " Example 1: BufWritePre, :write, BufWritePost
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6264 " Example 2: FileReadPre, :read, FileReadPost.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6265 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6267 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6268
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6269 function! MSG(enr, emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6270 let english = v:lang == "C" || v:lang =~ '^[Ee]n'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6271 if a:enr == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6272 Xout "TODO: Add message number for:" a:emsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6273 let v:errmsg = ":" . v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6274 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6275 let match = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6276 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6277 let match = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6278 if v:errmsg == ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6279 Xout "Message missing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6280 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6281 let v:errmsg = escape(v:errmsg, '"')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6282 Xout "Unexpected message:" v:errmsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6283 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6284 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6285 return match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6286 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6288 " Remove the autocommands for the events specified as arguments in all used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6289 " autogroups.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10942
diff changeset
6290 function Delete_autocommands(...)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6291 let augfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6292 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6293 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6294 exec "redir >" . augfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6295 aug
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6296 redir END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6297 exec "edit" augfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6298 g/^$/d
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6299 norm G$
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6300 let wrap = "w"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6301 while search('\%( \|^\)\@<=.\{-}\%( \)\@=', wrap) > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6302 let wrap = "W"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6303 exec "norm y/ \n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6304 let argno = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6305 while argno <= a:0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6306 exec "au!" escape(@", " ") a:{argno}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6307 let argno = argno + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6308 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6309 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6310 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6311 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6312 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6313 call delete(augfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6314 break " discard errors for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6315 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6316 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6317 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6319 call Delete_autocommands("BufWritePre", "BufWritePost")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6321 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6322 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6323 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6324 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6325 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6326 au! BufWritePost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6327 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6328 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6329 write /n/o/n/e/x/i/s/t/e/n/t
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6330 catch /^Vim(write):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6331 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6332 let v:errmsg = substitute(v:exception, '^Vim(write):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6333 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6334 Xpath 1 " X: 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6335 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6336 Xpath 2 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6337 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6338 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
6339 \ '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6340 if !MSG('E212', "Can't open file for writing")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6341 Xpath 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6342 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6343 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6344 Xpath 8 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6345 Xout "BufWritePost commands executed after write error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6346 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6347 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6348 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6349 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6350 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6351 Xpath 16 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6352 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6353 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6354 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6355 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6356 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6358 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6359 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6360 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6361 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6362 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6363 au! BufWritePre * asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6364 au! BufWritePost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6365 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6366 let tmpfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6367 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6368 exec "write" tmpfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6369 catch /^Vim\((write)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6370 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6371 let v:errmsg = substitute(v:exception, '^Vim\((write)\)\=:', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6372 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6373 Xpath 32 " X: 32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6374 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6375 Xpath 64 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6376 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6377 let v:errmsg = substitute(v:errmsg, '^"'.tmpfile.'" ', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6378 if !MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6379 Xpath 128 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6380 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6381 if filereadable(tmpfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6382 Xpath 256 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6383 Xout ":write command not suppressed after BufWritePre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6384 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6385 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6386 Xpath 512 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6387 Xout "BufWritePost commands executed after BufWritePre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6388 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6389 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6390 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6391 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6392 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6393 Xpath 1024 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6394 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6395 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6396 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6397 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6398 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6400 call delete(tmpfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6402 call Delete_autocommands("BufWritePre", "BufWritePost",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6403 \ "BufReadPre", "BufReadPost", "FileReadPre", "FileReadPost")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6404
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6405 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6406 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6407 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6408 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6409 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6410 au! FileReadPost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6411 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6412 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6413 read /n/o/n/e/x/i/s/t/e/n/t
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6414 catch /^Vim(read):/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6415 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6416 let v:errmsg = substitute(v:exception, '^Vim(read):', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6417 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6418 Xpath 2048 " X: 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6419 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6420 Xpath 4096 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6421 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6422 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
6423 \ '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6424 if !MSG('E484', "Can't open file")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6425 Xpath 8192 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6426 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6427 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6428 Xpath 16384 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6429 Xout "FileReadPost commands executed after write error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6430 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6431 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6432 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6433 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6434 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6435 Xpath 32768 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6436 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6437 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6438 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6439 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6440 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6442 while 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6443 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6444 let infile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6445 let tmpfile = tempname()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6446 exec "!echo XYZ >" . infile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6447 exec "edit" tmpfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6448 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6449 Xpath 65536 " X: 65536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6450 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6451 let post = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6452 aug TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6453 au! FileReadPre * asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6454 au! FileReadPost * let post = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6455 aug END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6456 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6457 exec "0read" infile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6458 catch /^Vim\((read)\)\=:/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6459 let caught = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6460 let v:errmsg = substitute(v:exception, '^Vim\((read)\)\=:', '',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6461 \ "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6462 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6463 Xpath 131072 " X: 131072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6464 if !caught && !$VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6465 Xpath 262144 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6466 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6467 let v:errmsg = substitute(v:errmsg, ' '.infile.'$', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6468 if !MSG('E492', "Not an editor command")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6469 Xpath 524288 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6470 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6471 if getline("1") == "XYZ"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6472 Xpath 1048576 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6473 Xout ":read command not suppressed after FileReadPre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6474 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6475 if post
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6476 Xpath 2097152 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6477 Xout "FileReadPost commands executed after " .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6478 \ "FileReadPre error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6479 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6480 au! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6481 aug! TMP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6482 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6483 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6484 bwipeout!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6485 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6486 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6487 Xpath 4194304 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6488 Xout v:exception "in" v:throwpoint
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6489 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6490 break " discard error for $VIMNOERRTHROW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6491 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6492 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6494 call delete(infile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6495 call delete(tmpfile)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6496 unlet! caught post infile tmpfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6497 delfunction MSG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6498 delfunction Delete_autocommands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6499
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6500 Xcheck 198689
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6501
3918
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6502 "-------------------------------------------------------------------------------
3994
ed936effb1f3 updated for version 7.3.752
Bram Moolenaar <bram@vim.org>
parents: 3918
diff changeset
6503 " Test 86: setloclist crash {{{1
3918
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6504 "
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6505 " Executing a setloclist() on BufUnload shouldn't crash Vim
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6506 "-------------------------------------------------------------------------------
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6507
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6508 func F
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6509 au BufUnload * :call setloclist(0, [{'bufnr':1, 'lnum':1, 'col':1, 'text': 'tango down'}])
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6510
4774
531e598651fc updated for version 7.3.1134
Bram Moolenaar <bram@vim.org>
parents: 4182
diff changeset
6511 :lvimgrep /.*/ *.mak
3918
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6512 endfunc
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6513
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6514 XpathINIT
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6515
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6516 ExecAsScript F
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6517
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6518 delfunction F
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6519 Xout "No Crash for vimgrep on BufUnload"
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6520 Xcheck 0
4f0ddf4137ee updated for version 7.3.715
Bram Moolenaar <bram@vim.org>
parents: 2591
diff changeset
6521
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
6522 " Test 87 was moved to test_vimscript.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
6523 let Xtest = 88
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents: 18269
diff changeset
6524
4182
f4960ddda07c updated for version 7.3.843
Bram Moolenaar <bram@vim.org>
parents: 3994
diff changeset
6525
f4960ddda07c updated for version 7.3.843
Bram Moolenaar <bram@vim.org>
parents: 3994
diff changeset
6526 "-------------------------------------------------------------------------------
f4960ddda07c updated for version 7.3.843
Bram Moolenaar <bram@vim.org>
parents: 3994
diff changeset
6527 " Test 88: $VIMNOERRTHROW and $VIMNOINTTHROW support {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6528 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6529 " It is possible to configure Vim for throwing exceptions on error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6530 " or interrupt, controlled by variables $VIMNOERRTHROW and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6531 " $VIMNOINTTHROW. This is just for increasing the number of tests.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6532 " All tests here should run for all four combinations of setting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6533 " these variables to 0 or 1. The variables are intended for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6534 " development phase only. In the final release, Vim should be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6535 " configured to always use error and interrupt exceptions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6536 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6537 " The test result is "OK",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6538 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6539 " - if the $VIMNOERRTHROW and the $VIMNOINTTHROW control are not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6540 " configured and exceptions are thrown on error and on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6541 " interrupt.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6542 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6543 " - if the $VIMNOERRTHROW or the $VIMNOINTTHROW control is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6544 " configured and works as intended.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6545 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6546 " What actually happens, is shown in the test output.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6547 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6548 " Otherwise, the test result is "FAIL", and the test output describes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6549 " the problem.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6550 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6551 " IMPORTANT: This must be the last test because it sets $VIMNOERRTHROW and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6552 " $VIMNOINTTHROW.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6553 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6554
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6555 XpathINIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6557 if ExtraVim()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6559 function! ThrowOnError()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6560 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6561 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6562 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6563 Xloop 1 " X: 1 + 8 + 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6564 asdf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6565 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6566 let caught = 1 " error exception caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6567 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6568 Xloop 2 " X: 2 + 16 + 128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6569 return caught " discard aborting error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6570 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6571 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6572 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6573
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6574 let quits_skipped = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6576 function! ThrowOnInterrupt()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6577 XloopNEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6578 let caught = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6579 try
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6580 Xloop 1 " X: (1 + 8 + 64) * 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6581 "INTERRUPT3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6582 let dummy = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6583 let g:quits_skipped = g:quits_skipped + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6584 catch /.*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6585 let caught = 1 " interrupt exception caught
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6586 finally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6587 Xloop 2 " X: (2 + 16 + 128) * 512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6588 return caught " discard interrupt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6589 endtry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6590 Xloop 4 " X: 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6591 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6592
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6593 function! CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6594 execute 'return ThrowOn' . a:Type . '()'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6595 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6597 function! CheckConfiguration(type) " type is "error" or "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6599 let type = a:type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6600 let Type = substitute(type, '.*', '\u&', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6601 let VAR = '$VIMNO' . substitute(type, '\(...\).*', '\U\1', "") . 'THROW'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6602
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6603 if type == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6604 XloopINIT! 1 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6605 elseif type == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6606 XloopINIT! 512 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6607 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6609 exec 'let requested_for_tests = exists(VAR) && ' . VAR . ' == 0'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6610 exec 'let suppressed_for_tests = ' . VAR . ' != 0'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6611 let used_in_tests = CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6612
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6613 exec 'let ' . VAR . ' = 0'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6614 let request_works = CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6615
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6616 exec 'let ' . VAR . ' = 1'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6617 let suppress_works = !CheckThrow(Type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6618
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6619 if type == "error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6620 XloopINIT! 262144 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6621 elseif type == "interrupt"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6622 XloopINIT! 2097152 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6624 if g:quits_skipped != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6625 Xloop 1 " X: 0*2097152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6626 Xout "Test environment error. Interrupt breakpoints skipped: "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6627 \ . g:quits_skipped . ".\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6628 \ . "Cannot check whether interrupt exceptions are thrown."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6629 return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6630 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6631 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6632
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6633 let failure =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6634 \ !suppressed_for_tests && !used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6635 \ || !request_works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6637 let contradiction =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6638 \ used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6639 \ ? suppressed_for_tests && !request_works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6640 \ : !suppressed_for_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6641
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6642 if failure
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6643 " Failure in configuration.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6644 Xloop 2 " X: 0 * 2* (262144 + 2097152)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6645 elseif contradiction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6646 " Failure in test logic. Should not happen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6647 Xloop 4 " X: 0 * 4 * (262144 + 2097152)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6648 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6650 let var_control_configured =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6651 \ request_works != used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6652 \ || suppress_works == used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6653
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6654 let var_control_not_configured =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6655 \ requested_for_tests || suppressed_for_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6656 \ ? request_works && !suppress_works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6657 \ : request_works == used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6658 \ && suppress_works != used_in_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6659
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6660 let with = used_in_tests ? "with" : "without"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6661
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6662 let set = suppressed_for_tests ? "non-zero" :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6663 \ requested_for_tests ? "0" : "unset"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6665 let although = contradiction && !var_control_not_configured
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6666 \ ? ",\nalthough "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6667 \ : ".\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6668
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6669 let output = "All tests were run " . with . " throwing exceptions on "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6670 \ . type . although
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6671
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6672 if !var_control_not_configured
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6673 let output = output . VAR . " was " . set . "."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6674
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6675 if !request_works && !requested_for_tests
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6676 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6677 \ "\n" . Type . " exceptions are not thrown when " . VAR .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6678 \ " is\nset to 0."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6679 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6680
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6681 if !suppress_works && (!used_in_tests ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6682 \ !request_works &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6683 \ !requested_for_tests && !suppressed_for_tests)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6684 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6685 \ "\n" . Type . " exceptions are thrown when " . VAR .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6686 \ " is set to 1."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6687 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6688
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6689 if !failure && var_control_configured
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6690 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6691 \ "\nRun tests also with " . substitute(VAR, '^\$', '', "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6692 \ . "=" . used_in_tests . "."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6693 \ . "\nThis is for testing in the development phase only."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6694 \ . " Remove the \n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6695 \ . VAR . " control in the final release."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6696 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6697 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6698 let output = output .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6699 \ "The " . VAR . " control is not configured."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6700 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6702 Xout output
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6703 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6704
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6705 call CheckConfiguration("error")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6706 Xpath 16777216 " X: 16777216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6707 call CheckConfiguration("interrupt")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6708 Xpath 33554432 " X: 33554432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6709 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6711 Xcheck 50443995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6712
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6713 " IMPORTANT: No test should be added after this test because it changes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6714 " $VIMNOERRTHROW and $VIMNOINTTHROW.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6716
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6717 "-------------------------------------------------------------------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6718 " Modelines {{{1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6719 " vim: ts=8 sw=4 tw=80 fdm=marker
16760
b55b4a21f006 patch 8.1.1382: error when editing test file
Bram Moolenaar <Bram@vim.org>
parents: 15456
diff changeset
6720 "-------------------------------------------------------------------------------