annotate src/testdir/test_trycatch.vim @ 31160:eff0d98467e3 v9.0.0914

patch 9.0.0914: deletebufline() may move marks in the wrong window Commit: https://github.com/vim/vim/commit/228e422855d43965f2c3319ff0cdc26ea422c10f Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Nov 20 11:13:17 2022 +0000 patch 9.0.0914: deletebufline() may move marks in the wrong window Problem: deletebufline() may move marks in the wrong window. Solution: Find a window for the buffer being changed. (closes https://github.com/vim/vim/issues/11583)
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Nov 2022 12:15:04 +0100
parents c8ebe35b2475
children 6f74f567b1e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test try-catch-finally exception handling
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Most of this was formerly in test49.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source check.vim
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 source shared.vim
30483
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
6 import './vim9.vim' as v9
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " Test environment {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 com! XpathINIT let g:Xpath = ''
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args>
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 " Test 25: Executing :finally clauses on normal control flow {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " Control flow in a :try conditional should always fall through to its
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 " :finally clause. A :finally clause of a :try conditional inside an
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " inactive conditional should never be executed.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 func T25_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 if loops >= 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 Xpath 'f' . loops
22395
03249b8976a9 patch 8.2.1746: Vim9: cannot use "fina" for "finally"
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
41 final
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 Xpath 'g' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25905
diff changeset
53 " Also try using "fina" and "final" and "finall" as abbreviations.
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 func T25_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 if 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call T25_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 Xpath 'B'
22395
03249b8976a9 patch 8.2.1746: Vim9: cannot use "fina" for "finally"
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
60 fina
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 Xpath 'D'
22395
03249b8976a9 patch 8.2.1746: Vim9: cannot use "fina" for "finally"
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
66 finall
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 Xpath 'E'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 func Test_finally()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 call T25_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 call assert_equal('Aa3b3e3h3a2b2c2d2e2f2g2h2a1h1iBC', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 " Test 26: Executing :finally clauses after :continue or :break {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 " For a :continue or :break dynamically enclosed in a :try/:endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 " region inside the next surrounding :while/:endwhile, if the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 " :continue/:break is before the :finally, the :finally clause is
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 " executed first. If the :continue/:break is after the :finally, the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 " :finally clause is broken (like an :if/:endif region).
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 func T26_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 continue
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 finish
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 continue
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 Xpath 'i' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 finish
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 Xpath 'j' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 Xpath 'k' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 func Test_finally_after_continue()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 call T26_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 call assert_equal('c3d3e3a2d1b1d1fgj3k3h2i1lm', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 " Test 32: Remembering the :return value on :finally {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 " If a :finally clause is executed due to a :return specifying
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 " a value, this is the value visible to the caller if not overwritten
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 " by a new :return in the :finally clause. A :return without a value
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 " in the :finally clause overwrites with value 0.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 func T32_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 return "ABCD"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 func T32_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 return 8
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 return 16 + strlen(T32_F())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 func T32_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 return 32
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 func T32_I()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 return T32_G() + T32_H() + 64
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 func Test_finally_return()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 call assert_equal(84, T32_I())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 call assert_equal('rshjabdfmo', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 " Test 33: :return under :execute or user command and :finally {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 " A :return command may be executed under an ":execute" or from
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 " a user command. Executing of :finally clauses and passing through
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 " the return code works also then.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 func T33_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 RETURN 10
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 func T33_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 RETURN 20
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 RETURN 30
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 func T33_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 execute "try | return 40 | finally | return 50 | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 func T33_I()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 execute "try | return 60 | finally | return 70 | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 execute "try | return 80 | finally | return 90 | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 func T33_J()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 RETURN 100
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 func T33_K()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 execute "try | return 110 | finally | return 120 | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 execute "try | return 130 | finally | return | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 func T33_L()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 RETURN 140
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 func T33_M()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 execute "try | return 150 | finally | return 160 | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 func T33_N()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 RETURN 170
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 func T33_O()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 execute "try | return 180 | finally | return 190 | endtry"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 func Test_finally_cmd_return()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 command! -nargs=? RETURN
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 \ try | return <args> | finally | return <args> * 2 | endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 call assert_equal(20, T33_F())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 call assert_equal(60, T33_G())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 call assert_equal(50, T33_H())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 call assert_equal(90, T33_I())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 call assert_equal(0, T33_J())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 call assert_equal(0, T33_K())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 call assert_equal(280, T33_L())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 call assert_equal(160, T33_M())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 call assert_equal(340, T33_N())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 call assert_equal(190, T33_O())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 call assert_equal('beilptxB', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 delcommand RETURN
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 " Test 41: Skipped :throw finding next command {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 " A :throw in an inactive conditional must not hide a following
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347 " command.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 func T41_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 if 0 | throw 'never' | endif | Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 func T41_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 while 0 | throw 'never' | endwhile | Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 func T41_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 if 0 | try | throw 'never' | endtry | endif | Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 func Test_throw_inactive_cond()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 call T41_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
380 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
381 call T41_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
390 call T41_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
391 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
393 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
394 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
395 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
396
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
397 call assert_equal('jabckmdefnpghiq', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
398 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
399
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
400
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
401 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
402 " Test 42: Catching number and string exceptions {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
403 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404 " When a number is thrown, it is converted to a string exception.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
405 " Numbers and strings may be caught by specifying a regular exception
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
406 " as argument to the :catch command.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
407 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
408
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
410 func T42_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
411 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417 catch /4711/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
422 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 catch /^4711$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 catch /\d/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 catch /^\d\+$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 catch /arrgh/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
457 catch /^arrgh$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 catch /\l/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 catch /^\l\+$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
479 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480 throw "ARRGH"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 catch /^arrgh$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
484 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 catch /^\carrgh$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
491 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
492 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494 Xpath 'E'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
498 Xpath 'F'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
499 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
500 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
501 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
502
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
503 func Test_catch_number_string()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
504 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
505 call T42_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
506 call assert_equal('acdfgijlmoprsuvxyBCE', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
507 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
508
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
509
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
510 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511 " Test 43: Selecting the correct :catch clause {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
512 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
513 " When an exception is thrown and there are multiple :catch clauses,
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
514 " the first matching one is taken.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
515 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
516
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
517 func T43_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
518 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
519 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
521 if loops == 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
522 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
523 throw "a"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
524 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
525 elseif loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
526 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527 throw "ab"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
531 throw "abc"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532 Xpath 'f' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
534 catch /abc/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
535 Xpath 'g' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
536 catch /ab/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
537 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
538 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
539 Xpath 'i' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
540 catch /a/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
541 Xpath 'j' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
542 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
546 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
548
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 func Test_multi_catch()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551 call T43_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 call assert_equal('a3i3c2h2e1g1k', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
555
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
557 " Test 44: Missing or empty :catch patterns {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
558 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
559 " A missing or empty :catch pattern means the same as /.*/, that is,
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
560 " catches everything. To catch only empty exceptions, /^$/ must be
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561 " used. A :catch with missing, empty, or /.*/ argument also works
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
562 " when followed by another command separated by a bar on the same
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
563 " line. :catch patterns cannot be specified between ||. But other
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 " pattern separators can be used instead of //.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 func T44_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
577 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 catch //
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
587 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 catch
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 throw "oops"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
601 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 catch //
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 throw "brrr"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
620 catch
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
622 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 try | Xpath 'r' | throw "x" | catch /.*/ | Xpath 's' | endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 try | Xpath 't' | throw "y" | catch // | Xpath 'u' | endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
627
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
628 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
630 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
631 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
632 " Extra try level: if ":catch" without arguments below raises
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
633 " a syntax error because it misinterprets the "Xpath" as a pattern,
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
634 " let it be caught by the ":catch /.*/" below.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
635 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 try | Xpath 'v' | throw "z" | catch | Xpath 'w' | :
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
639 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643 if $VIMNOERRTHROW && v:errmsg != ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 call assert_report(v:errmsg)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
645 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 if caught || $VIMNOERRTHROW && v:errmsg != ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
648 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
650 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
653 let cologne = 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
656 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
657 throw "throw cologne"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658 " Next lines catches all and throws 4711:
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
659 catch |throw cologne|
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
661 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
662 catch /4711/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
665
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
666 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
668 throw "plus"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669 catch +plus+
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
671 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
672
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
675 Xpath 'E'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
677 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
679
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680 func Test_empty_catch()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
682 call T44_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
683 call assert_equal('abcdefghiklnoqrstuvwyABCD', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
686
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
687 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688 " Test 45: Catching exceptions from nested :try blocks {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
689 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
690 " When :try blocks are nested, an exception is caught by the innermost
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691 " try conditional that has a matching :catch clause.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694 func T45_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
698 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
699 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
700 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 if loops == 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
702 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 throw "a"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
705 elseif loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
707 throw "ab"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
708 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
709 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
710 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
711 throw "abc"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
712 Xpath 'f' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
713 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
714 catch /abc/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
715 Xpath 'g' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
717 catch /ab/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
718 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
719 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
720 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 Xpath 'i' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
722 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
723 catch /a/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
724 Xpath 'j' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
725 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
726
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
729 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
731
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
732 func Test_catch_from_nested_try()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
733 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
734 call T45_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
735 call assert_equal('a3i3c2h2e1g1k', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
737
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
738
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
739 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
740 " Test 46: Executing :finally after a :throw in nested :try {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
741 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
742 " When an exception is thrown from within nested :try blocks, the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
743 " :finally clauses of the non-catching try conditionals should be
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
744 " executed before the matching :catch of the next surrounding :try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
745 " gets the control. If this also has a :finally clause, it is
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
746 " executed afterwards.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749 func T46_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 let sum = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
751
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
753 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
754 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
755 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760 throw "ABC"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 catch /xyz/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
764 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
766 if sum != 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 let sum = sum + 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 catch /123/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 catch /321/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
778 if sum != 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
779 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
780 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
781 let sum = sum + 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
782 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
783 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
784 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
785 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
786 if sum != 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
787 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
788 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
789 let sum = sum + 4
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
790 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
791 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
792 catch /ABC/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
793 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
794 if sum != 7
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
795 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
796 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
797 let sum = sum + 8
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
798 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
799 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
800 if sum != 15
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
801 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
802 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
803 let sum = sum + 16
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
804 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
805 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
806 if sum != 31
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
807 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
808 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
809 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
810
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811 func Test_finally_after_throw()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813 call T46_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814 call assert_equal('abcdglortv', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 " Test 47: Throwing exceptions from a :catch clause {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
820 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 " When an exception is thrown from a :catch clause, it should not be
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822 " caught by a :catch of the same :try conditional. After executing
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823 " the :finally clause (if present), surrounding try conditionals
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824 " should be checked for a matching :catch.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 func T47_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
829 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
830 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
831 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
832 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 throw "x1"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
836 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 throw "x2"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
843 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
845 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 throw "x3"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
850 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
851 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
852 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
864 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
865 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
866 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
867 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
868 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
869 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
870 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
871 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
872 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
873 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
874 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
875 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
876 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
877 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
878 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
879 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
880 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
881 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
882 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
883 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
884 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
885 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
886 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
887
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
888 func Test_throw_from_catch()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
889 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
890 call T47_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
891 call assert_equal('abcdfgjkovzAC', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
892 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
893
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
894
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
895 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
896 " Test 48: Throwing exceptions from a :finally clause {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
897 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
898 " When an exception is thrown from a :finally clause, it should not be
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
899 " caught by a :catch of the same :try conditional. Surrounding try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
900 " conditionals should be checked for a matching :catch. A previously
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
901 " thrown exception is discarded.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
902 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
903
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
904 func T48_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
905 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
906
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
907 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
908 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
909 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
910 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
911 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
912 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
913 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
914 throw "x1"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
915 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
916 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
917 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
918 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
919 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
920 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
921 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
922
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
923 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
924 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926 throw "x2"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
927 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
928 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
929 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
930 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
931 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
932 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
933 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
934 throw "x3"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
935 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
936 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
938 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
939 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
940 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
941 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
942 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
943 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
944
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
945 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
946 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
947 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
948 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
949 throw "x4"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
950 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
951 catch /x5/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
952 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
953 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
954 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
955 throw "x5" " discards 'x4'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
956 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
957 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
958 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
959 catch /x4/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
960 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
961 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
962 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
963 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
964 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
965 catch /x5/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
966 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
967 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
968 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
969
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
970 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
971 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
972 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
973 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
974 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
975 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
976
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
977 func Test_throw_from_finally()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
978 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
979 call T48_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
980 call assert_equal('acfghjlpqruyABD', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
981 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
982
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
983
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
984 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
985 " Test 51: Throwing exceptions across :execute and user commands {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
986 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
987 " A :throw command may be executed under an ":execute" or from
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
988 " a user command.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
989 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
990
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
991 func T51_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
992 command! -nargs=? THROW1 throw <args> | throw 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
993 command! -nargs=? THROW2 try | throw <args> | endtry | throw 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
994 command! -nargs=? THROW3 try | throw 3 | catch /3/ | throw <args> | endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
995 command! -nargs=? THROW4 try | throw 4 | finally | throw <args> | endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
996
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
997 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
998
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
999 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1000 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1001 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1002 THROW1 "A"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1003 catch /A/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1004 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1005 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006 catch /1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1007 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1008 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1009
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1010 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1011 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1012 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1013 THROW2 "B"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1014 catch /B/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1015 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1016 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1017 catch /2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1018 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1019 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1020
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1021 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1022 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1023 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1024 THROW3 "C"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1025 catch /C/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1026 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1027 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1028 catch /3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1029 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1030 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1031
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1032 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1033 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1034 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1035 THROW4 "D"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1036 catch /D/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1037 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1038 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1039 catch /4/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1040 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1041 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1042
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1043 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1044 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1045 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1046 execute 'throw "E" | throw 5'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1047 catch /E/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1048 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1049 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1050 catch /5/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1051 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1052 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1053
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1054 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1055 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1056 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1057 execute 'try | throw "F" | endtry | throw 6'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1058 catch /F/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1059 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1060 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1061 catch /6/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1062 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1063 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1064
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1065 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1066 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1067 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1068 execute'try | throw 7 | catch /7/ | throw "G" | endtry'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1069 catch /G/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1070 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1071 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1072 catch /7/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1073 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1074 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1075
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1076 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1077 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1078 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1079 execute 'try | throw 8 | finally | throw "H" | endtry'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1080 catch /H/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1081 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1082 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1083 catch /8/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1084 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1085 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1086
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1087 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1088 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1089 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1090 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1091
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1092 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1093
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1094 delcommand THROW1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1095 delcommand THROW2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1096 delcommand THROW3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1097 delcommand THROW4
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1098 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1099
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1100 func Test_throw_across_commands()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1101 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1102 call T51_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1103 call assert_equal('abdeghjkmnpqstvwz', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1104 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1105
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1106
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1107
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1108 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1109 " Test 69: :throw across :if, :elseif, :while {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1110 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1111 " On an :if, :elseif, or :while command, an exception might be thrown
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1112 " during evaluation of the expression to test. The exception can be
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1113 " caught by the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1114 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1115
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1116 func T69_throw(x)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1117 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1118 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1119 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1120
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1121 func Test_throw_ifelsewhile()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1122 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1123
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1124 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1125 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1126 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1127 if 111 == T69_throw("if") + 111
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1128 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1129 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1130 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1131 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1132 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1133 catch /^if$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1134 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1135 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1136 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1137 call assert_report("if: " . v:exception . " in " . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1138 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1139
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1140 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1141 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1142 if v:false
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1143 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1144 elseif 222 == T69_throw("elseif") + 222
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1145 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1146 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1147 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1148 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1149 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1150 catch /^elseif$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1151 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1152 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1153 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1154 call assert_report("elseif: " . v:exception . " in " . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1155 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1156
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1157 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1158 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1159 while 333 == T69_throw("while") + 333
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1160 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1161 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1162 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1163 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1164 catch /^while$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1165 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1166 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1167 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1168 call assert_report("while: " .. v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1169 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1170 catch /^0$/ " default return value
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1171 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1172 call assert_report(v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1173 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1174 call assert_report(v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1175 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1176 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1177
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1178 call assert_equal('axegxlnxq', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1179 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1180
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1181
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1182 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1183 " Test 70: :throw across :return or :throw {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1184 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1185 " On a :return or :throw command, an exception might be thrown during
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1186 " evaluation of the expression to return or throw, respectively. The
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1187 " exception can be caught by the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1188 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1189
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1190 let T70_taken = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1191
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1192 func T70_throw(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1193 let g:T70_taken = g:T70_taken . "T" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1194 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1195 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1196
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1197 func T70_F(x, y, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1198 let g:T70_taken = g:T70_taken . "F" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1199 return a:x + T70_throw(a:y, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1200 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1201
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1202 func T70_G(x, y, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1203 let g:T70_taken = g:T70_taken . "G" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1204 throw a:x . T70_throw(a:y, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1205 return a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1206 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1207
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1208 func Test_throwreturn()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1209 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1210
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1211 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1212 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1213 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1214 call T70_F(4711, "return", 1)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1215 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1216 catch /^return$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1217 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1218 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1219 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1220 call assert_report("return: " .. v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1221 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1222
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1223 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1224 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1225 let var = T70_F(4712, "return-var", 2)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1226 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1227 catch /^return-var$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1228 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1229 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1230 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1231 call assert_report("return-var: " . v:exception . " in " . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1232 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1233 unlet! var
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1234 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1235
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1236 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1237 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1238 throw "except1" . T70_throw("throw1", 3)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1239 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1240 catch /^except1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1241 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1242 catch /^throw1$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1243 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1244 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1245 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1246 call assert_report("throw1: " .. v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1247 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1248
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1249 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1250 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1251 call T70_G("except2", "throw2", 4)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1252 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1253 catch /^except2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1254 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1255 catch /^throw2$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1256 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1257 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1258 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1259 call assert_report("throw2: " .. v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1260 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1261
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1262 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1263 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1264 let var = T70_G("except3", "throw3", 5)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1265 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1266 catch /^except3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1267 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1268 catch /^throw3$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1269 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1270 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1271 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1272 call assert_report("throw3: " .. v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1273 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1274 unlet! var
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1275 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1276
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1277 call assert_equal('F1T1F2T2T3G4T4G5T5', g:T70_taken)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1278 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1279 catch /^0$/ " default return value
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1280 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1281 call assert_report(v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1282 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1283 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1284 call assert_report('Caught' .. v:exception .. ' in ' .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1285 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1286
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1287 call assert_equal('acegilnqsvx', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1288 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1289
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1290 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1291 " Test 71: :throw across :echo variants and :execute {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1292 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1293 " On an :echo, :echon, :echomsg, :echoerr, or :execute command, an
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1294 " exception might be thrown during evaluation of the arguments to
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1295 " be displayed or executed as a command, respectively. Any following
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1296 " arguments are not evaluated, then. The exception can be caught by
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1297 " the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1298 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1299
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1300 let T71_taken = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1301
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1302 func T71_throw(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1303 let g:T71_taken = g:T71_taken . "T" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1304 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1305 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1306
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1307 func T71_F(n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1308 let g:T71_taken = g:T71_taken . "F" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1309 return "F" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1310 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1311
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1312 func Test_throw_echo()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1313 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1314
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1315 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1316 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1317 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1318 echo 'echo ' . T71_throw("echo-except", 1) . T71_F(1)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1319 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1320 catch /^echo-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1321 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1322 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1323 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1324 call assert_report("echo: " .. v:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1325 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1326
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1327 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1328 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1329 echon "echon " . T71_throw("echon-except", 2) . T71_F(2)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1330 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1331 catch /^echon-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1332 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1333 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1334 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1335 call assert_report('echon: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1336 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1337
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1338 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1339 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1340 echomsg "echomsg " . T71_throw("echomsg-except", 3) . T71_F(3)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1341 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1342 catch /^echomsg-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1343 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1344 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1345 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1346 call assert_report('echomsg: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1347 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1348
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1349 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1350 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1351 echoerr "echoerr " . T71_throw("echoerr-except", 4) . T71_F(4)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1352 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1353 catch /^echoerr-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1354 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1355 catch /Vim/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1356 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1357 catch /echoerr/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1358 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1359 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1360 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1361 call assert_report('echoerr: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1362 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1363
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1364 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1365 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1366 execute "echo 'execute " . T71_throw("execute-except", 5) . T71_F(5) "'"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1367 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1368 catch /^execute-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1369 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1370 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1371 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1372 call assert_report('execute: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1373 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1374
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1375 call assert_equal('T1T2T3T4T5', g:T71_taken)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1376 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1377 catch /^0$/ " default return value
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1378 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1379 call assert_report(v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1380 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1381 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1382 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1383 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1384
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1385 call assert_equal('acegikmosuw', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1386 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1387
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1388
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1389 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1390 " Test 72: :throw across :let or :unlet {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1391 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1392 " On a :let command, an exception might be thrown during evaluation
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1393 " of the expression to assign. On an :let or :unlet command, the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1394 " evaluation of the name of the variable to be assigned or list or
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1395 " deleted, respectively, may throw an exception. Any following
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1396 " arguments are not evaluated, then. The exception can be caught by
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1397 " the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1398 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1399
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1400 let throwcount = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1401
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1402 func T72_throw(x)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1403 let g:throwcount = g:throwcount + 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1404 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1405 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1406
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1407 let T72_addpath = ''
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1408
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1409 func T72_addpath(p)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1410 let g:T72_addpath = g:T72_addpath . a:p
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1411 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1412
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1413 func Test_throw_let()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1414 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1415
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1416 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1417 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1418 let $VAR = 'old_value'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1419 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1420 let $VAR = 'let(' . T72_throw('var') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1421 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1422 catch /^var$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1423 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1424 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1425 call assert_equal('old_value', $VAR)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1426 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1427
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1428 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1429 let @a = 'old_value'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1430 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1431 let @a = 'let(' . T72_throw('reg') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1432 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1433 catch /^reg$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1434 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1435 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1436 let @A = 'let(' . T72_throw('REG') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1437 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1438 catch /^REG$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1439 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1440 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1441 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1442 call assert_equal('old_value', @a)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1443 call assert_equal('old_value', @A)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1444 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1445
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1446 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1447 let saved_gpath = &g:path
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1448 let saved_lpath = &l:path
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1449 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1450 let &path = 'let(' . T72_throw('opt') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1451 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1452 catch /^opt$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1453 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1454 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1455 let &g:path = 'let(' . T72_throw('gopt') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1456 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1457 catch /^gopt$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1458 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1459 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1460 let &l:path = 'let(' . T72_throw('lopt') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1461 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1462 catch /^lopt$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1463 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1464 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1465 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1466 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1467 call assert_equal(saved_gpath, &g:path)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1468 call assert_equal(saved_lpath, &l:path)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1469 let &g:path = saved_gpath
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1470 let &l:path = saved_lpath
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1471 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1472
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1473 unlet! var1 var2 var3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1474
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1475 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1476 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1477 let var1 = 'let(' . T72_throw('var1') . ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1478 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1479 catch /^var1$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1480 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1481 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1482 call assert_true(!exists('var1'))
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1483 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1484
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1485 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1486 let var2 = 'old_value'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1487 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1488 let var2 = 'let(' . T72_throw('var2'). ')'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1489 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1490 catch /^var2$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1491 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1492 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1493 call assert_equal('old_value', var2)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1494 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1495
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1496 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1497 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1498 let var{T72_throw('var3')} = 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1499 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1500 catch /^var3$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1501 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1502 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1503
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1504 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1505 call T72_addpath('T1')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1506 let var{T72_throw('var4')} var{T72_addpath('T2')} | call T72_addpath('T3')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1507 call T72_addpath('T4')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1508 catch /^var4$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1509 call T72_addpath('T5')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1510 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1511
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1512 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1513 call T72_addpath('T6')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1514 unlet var{T72_throw('var5')} var{T72_addpath('T7')}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1515 \ | call T72_addpath('T8')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1516 call T72_addpath('T9')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1517 catch /^var5$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1518 call T72_addpath('T10')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1519 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1520
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1521 call assert_equal('T1T5T6T10', g:T72_addpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1522 call assert_equal(11, g:throwcount)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1523 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1524 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1525 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1526
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1527 call assert_equal('acdfhikmoprsuvx', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1528 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1529
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1530
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1531 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1532 " Test 73: :throw across :function, :delfunction {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1533 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1534 " The :function and :delfunction commands may cause an expression
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1535 " specified in braces to be evaluated. During evaluation, an
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1536 " exception might be thrown. The exception can be caught by the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1537 " script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1538 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1539
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1540 let T73_taken = ''
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1541
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1542 func T73_throw(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1543 let g:T73_taken = g:T73_taken . 'T' . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1544 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1545 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1546
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1547 func T73_expr(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1548 let g:T73_taken = g:T73_taken . 'E' . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1549 if a:n % 2 == 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1550 call T73_throw(a:x, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1551 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1552 return 2 - a:n % 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1553 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1554
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1555 func Test_throw_func()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1556 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1557
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1558 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1559 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1560 " Define function.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1561 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1562 function! F0()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1563 endfunction
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1564 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1565 function! F{T73_expr('function-def-ok', 1)}()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1566 endfunction
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1567 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1568 function! F{T73_expr('function-def', 2)}()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1569 endfunction
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1570 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1571 catch /^function-def-ok$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1572 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1573 catch /^function-def$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1574 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1575 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1576 call assert_report('def: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1577 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1578
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1579 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1580 " List function.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1581 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1582 function F0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1583 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1584 function F{T73_expr('function-lst-ok', 3)}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1585 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1586 function F{T73_expr('function-lst', 4)}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1587 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1588 catch /^function-lst-ok$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1589 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1590 catch /^function-lst$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1591 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1592 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1593 call assert_report('lst: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1594 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1595
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1596 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1597 " Delete function
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1598 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1599 delfunction F0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1600 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1601 delfunction F{T73_expr('function-del-ok', 5)}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1602 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1603 delfunction F{T73_expr('function-del', 6)}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1604 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1605 catch /^function-del-ok$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1606 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1607 catch /^function-del$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1608 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1609 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1610 call assert_report('del: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1611 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1612 call assert_equal('E1E2T2E3E4T4E5E6T6', g:T73_taken)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1613 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1614 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1615 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1616
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1617 call assert_equal('abcfghilmnor', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1618 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1619
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1620
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1621 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1622 " Test 74: :throw across builtin functions and commands {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1623 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1624 " Some functions like exists(), searchpair() take expression
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1625 " arguments, other functions or commands like substitute() or
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1626 " :substitute cause an expression (specified in the regular
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1627 " expression) to be evaluated. During evaluation an exception
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1628 " might be thrown. The exception can be caught by the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1629 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1630
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1631 let T74_taken = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1632
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1633 func T74_throw(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1634 let g:T74_taken = g:T74_taken . "T" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1635 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1636 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1637
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1638 func T74_expr(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1639 let g:T74_taken = g:T74_taken . "E" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1640 call T74_throw(a:x . a:n, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1641 return "EXPR"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1642 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1643
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1644 func T74_skip(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1645 let g:T74_taken = g:T74_taken . "S" . a:n . "(" . line(".")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1646 let theline = getline(".")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1647 if theline =~ "skip"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1648 let g:T74_taken = g:T74_taken . "s)"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1649 return 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1650 elseif theline =~ "throw"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1651 let g:T74_taken = g:T74_taken . "t)"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1652 call T74_throw(a:x . a:n, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1653 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1654 let g:T74_taken = g:T74_taken . ")"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1655 return 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1656 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1657 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1658
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1659 func T74_subst(x, n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1660 let g:T74_taken = g:T74_taken . "U" . a:n . "(" . line(".")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1661 let theline = getline(".")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1662 if theline =~ "not" " T74_subst() should not be called for this line
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1663 let g:T74_taken = g:T74_taken . "n)"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1664 call T74_throw(a:x . a:n, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1665 elseif theline =~ "throw"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1666 let g:T74_taken = g:T74_taken . "t)"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1667 call T74_throw(a:x . a:n, a:n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1668 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1669 let g:T74_taken = g:T74_taken . ")"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1670 return "replaced"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1671 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1672 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1673
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1674 func Test_throw_builtin_func()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1675 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1676
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1677 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1678 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1679 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1680 let result = exists('*{T74_expr("exists", 1)}')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1681 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1682 catch /^exists1$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1683 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1684 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1685 let result = exists('{T74_expr("exists", 2)}')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1686 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1687 catch /^exists2$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1688 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1689 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1690 call assert_report('exists2: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1691 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1692 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1693 call assert_report('exists1: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1694 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1695
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1696 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1697 let file = tempname()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1698 exec "edit" file
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1699 call append(0, [
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1700 \ 'begin',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1701 \ 'xx',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1702 \ 'middle 3',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1703 \ 'xx',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1704 \ 'middle 5 skip',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1705 \ 'xx',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1706 \ 'middle 7 throw',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1707 \ 'xx',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1708 \ 'end'])
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1709 normal! gg
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1710 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1711 let result = searchpair("begin", "middle", "end", '',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1712 \ 'T74_skip("searchpair", 3)')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1713 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1714 let result = searchpair("begin", "middle", "end", '',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1715 \ 'T74_skip("searchpair", 4)')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1716 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1717 let result = searchpair("begin", "middle", "end", '',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1718 \ 'T74_skip("searchpair", 5)')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1719 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1720 catch /^searchpair[35]$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1721 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1722 catch /^searchpair4$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1723 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1724 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1725 call assert_report('searchpair: ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1726 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1727 bwipeout!
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1728 call delete(file)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1729 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1730
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1731 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1732 let file = tempname()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1733 exec "edit" file
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1734 call append(0, [
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1735 \ 'subst 1',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1736 \ 'subst 2',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1737 \ 'not',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1738 \ 'subst 4',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1739 \ 'subst throw',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1740 \ 'subst 6'])
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1741 normal! gg
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1742 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1743 1,2substitute/subst/\=T74_subst("substitute", 6)/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1744 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1745 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1746 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1747 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1748 3substitute/subst/\=T74_subst("substitute", 7)/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1749 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1750 if v:errmsg != ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1751 " If exceptions are not thrown on errors, fake the error
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1752 " exception in order to get the same execution path.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1753 throw "faked Vim(substitute)"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1754 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1755 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1756 catch /Vim(substitute)/ " Pattern not found ('e' flag missing)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1757 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1758 3substitute/subst/\=T74_subst("substitute", 8)/e
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1759 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1760 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1761 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1762 4,6substitute/subst/\=T74_subst("substitute", 9)/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1763 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1764 catch /^substitute[678]/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1765 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1766 catch /^substitute9/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1767 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1768 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1769 bwipeout!
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1770 call delete(file)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1771 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1772
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1773 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1774 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1775 let var = substitute("sub", "sub", '\=T74_throw("substitute()y", 10)', '')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1776 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1777 catch /substitute()y/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1778 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1779 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1780 call assert_report('substitute()y: ' . v:exception . ' in '
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1781 \ . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1782 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1783
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1784 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1785 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1786 let var = substitute("not", "sub", '\=T74_throw("substitute()n", 11)', '')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1787 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1788 catch /substitute()n/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1789 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1790 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1791 call assert_report('substitute()n: ' . v:exception . ' in '
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1792 \ . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1793 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1794
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1795 call assert_equal('E1T1E2T2S3(3)S4(5s)S4(7t)T4U6(1)U6(2)U9(4)U9(5t)T9T10',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1796 \ g:T74_taken)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1797
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1798 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1799 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1800 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1801
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1802 call assert_equal('acefgklmnopstvwx', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1803 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1804
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1805
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1806 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1807 " Test 75: Errors in builtin functions. {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1808 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1809 " On an error in a builtin function called inside a :try/:endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1810 " region, the evaluation of the expression calling that function and
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1811 " the command containing that expression are abandoned. The error can
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1812 " be caught as an exception.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1813 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1814 " A simple :call of the builtin function is a trivial case. If the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1815 " builtin function is called in the argument list of another function,
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1816 " no further arguments are evaluated, and the other function is not
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1817 " executed. If the builtin function is called from the argument of
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1818 " a :return command, the :return command is not executed. If the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1819 " builtin function is called from the argument of a :throw command,
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1820 " the :throw command is not executed. The evaluation of the
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1821 " expression calling the builtin function is abandoned.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1822 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1823
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1824 func T75_F1(arg1)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1825 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1826 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1827
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1828 func T75_F2(arg1, arg2)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1829 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1830 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1831
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1832 func T75_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1833 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1834 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1835
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1836 func T75_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1837 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1838 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1839
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1840 func T75_R()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1841 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1842 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1843 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1844 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1845 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1846 return append(1, "s")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1847 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1848 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1849 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1850 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1851 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1852 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1853 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1854 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1855 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1856 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1857 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1858 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1859 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1860 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1861
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1862 func Test_builtin_func_error()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1863 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1864
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1865 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1866 set noma " let append() fail with "E21"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1867
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1868 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1869 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1870 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1871 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1872 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1873 call append(1, "s")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1874 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1875 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1876 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1877 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1878 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1879 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1880 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1881 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1882 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1883 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1884 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1885 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1886
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1887 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1888 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1889 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1890 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1891 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1892 call T75_F1('x' . append(1, "s"))
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1893 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1894 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1895 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1896 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1897 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1898 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1899 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1900 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1901 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1902 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1903 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1904 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1905
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1906 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1907 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1908 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1909 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1910 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1911 call T75_F2('x' . append(1, "s"), T75_G())
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1912 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1913 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1914 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1915 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1916 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1917 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1918 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1919 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1920 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1921 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1922 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1923 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1924
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1925 call T75_R()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1926
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1927 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1928 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1929 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1930 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1931 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1932 throw "T" . append(1, "s")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1933 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1934 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1935 catch /^T.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1936 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1937 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1938 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1939 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1940 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1941 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1942 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1943 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1944 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1945 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1946 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1947
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1948 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1949 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1950 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1951 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1952 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1953 let x = "a"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1954 let x = x . "b" . append(1, "s") . T75_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1955 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1956 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1957 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1958 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1959 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1960 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1961 if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1962 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1963 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1964 call assert_equal('a', x)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1965 break " discard error for $VIMNOERRTHROW
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1966 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1967 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1968 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1969 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1970 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1971 set ma&
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1972 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1973
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1974 call assert_equal('jlmnpqrtueghivyzACD', g:Xpath)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1975 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1976
18886
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1977 func Test_reload_in_try_catch()
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30483
diff changeset
1978 call writefile(['x'], 'Xreload', 'D')
18886
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1979 set autoread
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1980 edit Xreload
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1981 tabnew
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1982 call writefile(['xx'], 'Xreload')
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1983 augroup ReLoad
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1984 au FileReadPost Xreload let x = doesnotexist
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1985 au BufReadPost Xreload let x = doesnotexist
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1986 augroup END
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1987 try
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1988 edit Xreload
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1989 catch
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1990 endtry
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1991 tabnew
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1992
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1993 tabclose
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1994 tabclose
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1995 autocmd! ReLoad
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1996 set noautoread
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1997 bwipe! Xreload
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1998 endfunc
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
1999
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2000 " Test for errors with :catch, :throw, :finally {{{1
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2001 func Test_try_catch_errors()
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2002 call assert_fails('throw |', 'E471:')
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2003 call assert_fails("throw \n ", 'E471:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
2004 call assert_fails('catch abc', 'E654:')
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2005 call assert_fails('try | let i = 1| finally | catch | endtry', 'E604:')
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2006 call assert_fails('finally', 'E606:')
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2007 call assert_fails('try | finally | finally | endtry', 'E607:')
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2008 call assert_fails('try | for i in range(5) | endif | endtry', 'E580:')
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2009 call assert_fails('try | while v:true | endtry', 'E170:')
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2010 call assert_fails('try | if v:true | endtry', 'E171:')
30483
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2011
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2012 " this was using a negative index in cstack[]
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2013 let lines =<< trim END
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2014 try
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2015 for
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2016 if
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2017 endwhile
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2018 if
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2019 finally
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2020 END
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2021 call v9.CheckScriptFailure(lines, 'E690:')
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2022
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2023 let lines =<< trim END
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2024 try
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2025 for
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2026 if
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2027 endwhile
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2028 if
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2029 endtry
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2030 END
4bbc920bdef7 patch 9.0.0577: buffer underflow with unexpected :finally
Bram Moolenaar <Bram@vim.org>
parents: 29010
diff changeset
2031 call v9.CheckScriptFailure(lines, 'E690:')
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2032 endfunc
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2033
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2034 " Test for verbose messages with :try :catch, and :finally {{{1
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2035 func Test_try_catch_verbose()
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2036 " This test works only when the language is English
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 19487
diff changeset
2037 CheckEnglish
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2038
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2039 set verbose=14
19487
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2040
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2041 " Test for verbose messages displayed when an exception is caught
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2042 redir => msg
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2043 try
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2044 echo i
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2045 catch /E121:/
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2046 finally
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2047 endtry
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2048 redir END
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2049 let expected = [
19487
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2050 \ 'Exception thrown: Vim(echo):E121: Undefined variable: i', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2051 \ 'Exception caught: Vim(echo):E121: Undefined variable: i', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2052 \ 'Exception finished: Vim(echo):E121: Undefined variable: i']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2053 call assert_equal(expected, split(msg, "\n"))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2054
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2055 " Test for verbose messages displayed when an exception is discarded
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2056 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2057 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2058 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2059 throw 'abc'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2060 finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2061 throw 'xyz'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2062 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2063 catch
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2064 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2065 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2066 let expected = [
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2067 \ 'Exception thrown: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2068 \ 'Exception made pending: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2069 \ 'Exception thrown: xyz', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2070 \ 'Exception discarded: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2071 \ 'Exception caught: xyz', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2072 \ 'Exception finished: xyz']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2073 call assert_equal(expected, split(msg, "\n"))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2074
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2075 " Test for messages displayed when :throw is resumed after :finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2076 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2077 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2078 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2079 throw 'abc'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2080 finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2081 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2082 catch
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2083 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2084 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2085 let expected = [
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2086 \ 'Exception thrown: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2087 \ 'Exception made pending: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2088 \ 'Exception resumed: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2089 \ 'Exception caught: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2090 \ 'Exception finished: abc']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2091 call assert_equal(expected, split(msg, "\n"))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2092
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2093 " Test for messages displayed when :break is resumed after :finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2094 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2095 for i in range(1)
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2096 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2097 break
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2098 finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2099 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2100 endfor
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2101 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2102 let expected = [':break made pending', '', ':break resumed']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2103 call assert_equal(expected, split(msg, "\n"))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2104
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2105 " Test for messages displayed when :continue is resumed after :finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2106 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2107 for i in range(1)
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2108 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2109 continue
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2110 finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2111 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2112 endfor
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2113 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2114 let expected = [':continue made pending', '', ':continue resumed']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2115 call assert_equal(expected, split(msg, "\n"))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2116
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2117 " Test for messages displayed when :return is resumed after :finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2118 func Xtest()
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2119 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2120 return 'vim'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2121 finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2122 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2123 endfunc
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2124 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2125 call Xtest()
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2126 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2127 let expected = [
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2128 \ 'calling Xtest()', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2129 \ ':return vim made pending', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2130 \ ':return vim resumed', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2131 \ 'Xtest returning ''vim''', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2132 \ 'continuing in Test_try_catch_verbose']
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2133 call assert_equal(expected, split(msg, "\n"))
19487
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2134 delfunc Xtest
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2135
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2136 " Test for messages displayed when :finish is resumed after :finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2137 call writefile(['try', 'finish', 'finally', 'endtry'], 'Xscript')
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2138 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2139 source Xscript
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2140 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2141 let expected = [
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2142 \ ':finish made pending', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2143 \ ':finish resumed', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2144 \ 'finished sourcing Xscript',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2145 \ 'continuing in Test_try_catch_verbose']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2146 call assert_equal(expected, split(msg, "\n")[1:])
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2147 call delete('Xscript')
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2148
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2149 " Test for messages displayed when a pending :continue is discarded by an
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2150 " exception in a finally handler
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2151 redir => msg
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2152 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2153 for i in range(1)
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2154 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2155 continue
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2156 finally
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2157 throw 'abc'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2158 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2159 endfor
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2160 catch
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2161 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2162 redir END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2163 let expected = [
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2164 \ ':continue made pending', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2165 \ 'Exception thrown: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2166 \ ':continue discarded', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2167 \ 'Exception caught: abc', '',
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2168 \ 'Exception finished: abc']
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2169 call assert_equal(expected, split(msg, "\n"))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2170
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2171 set verbose&
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2172 endfunc
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18886
diff changeset
2173
19487
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2174 " Test for throwing an exception from a BufEnter autocmd {{{1
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2175 func Test_BufEnter_exception()
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2176 augroup bufenter_exception
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2177 au!
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2178 autocmd BufEnter Xfile1 throw 'abc'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2179 augroup END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2180
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2181 let caught_abc = 0
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2182 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2183 sp Xfile1
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2184 catch /^abc/
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2185 let caught_abc = 1
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2186 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2187 call assert_equal(1, caught_abc)
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2188 call assert_equal(1, winnr('$'))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2189
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2190 augroup bufenter_exception
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2191 au!
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2192 augroup END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2193 augroup! bufenter_exception
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2194 %bwipe!
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2195
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2196 " Test for recursively throwing exceptions in autocmds
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2197 augroup bufenter_exception
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2198 au!
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2199 autocmd BufEnter Xfile1 throw 'bufenter'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2200 autocmd BufLeave Xfile1 throw 'bufleave'
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2201 augroup END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2202
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2203 let ex_count = 0
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2204 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2205 try
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2206 sp Xfile1
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2207 catch /^bufenter/
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2208 let ex_count += 1
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2209 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2210 catch /^bufleave/
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2211 let ex_count += 10
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2212 endtry
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2213 call assert_equal(10, ex_count)
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2214 call assert_equal(2, winnr('$'))
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2215
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2216 augroup bufenter_exception
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2217 au!
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2218 augroup END
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2219 augroup! bufenter_exception
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2220 %bwipe!
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2221 endfunc
0aba9ef12488 patch 8.2.0301: insufficient testing for exception handling
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
2222
23191
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2223 " Test for using try/catch in a user command with a failing expression {{{1
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2224 func Test_user_command_try_catch()
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2225 let lines =<< trim END
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2226 function s:throw() abort
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2227 throw 'error'
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2228 endfunction
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2229
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2230 command! Execute
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2231 \ try
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2232 \ | let s:x = s:throw()
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2233 \ | catch
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2234 \ | let g:caught = 'caught'
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2235 \ | endtry
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2236
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2237 let g:caught = 'no'
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2238 Execute
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2239 call assert_equal('caught', g:caught)
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2240 END
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2241 call writefile(lines, 'XtestTryCatch')
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2242 source XtestTryCatch
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2243
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2244 call delete('XtestTryCatch')
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2245 unlet g:caught
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2246 endfunc
3e7723bab4e5 patch 8.2.2141: a user command with try/catch may not catch an expression error
Bram Moolenaar <Bram@vim.org>
parents: 22395
diff changeset
2247
25761
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2248 " Test for using throw in a called function with following error {{{1
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2249 func Test_user_command_throw_in_function_call()
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2250 let lines =<< trim END
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2251 function s:get_dict() abort
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2252 throw 'my_error'
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2253 endfunction
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2254
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2255 try
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2256 call s:get_dict().foo()
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2257 catch /my_error/
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2258 let caught = 'yes'
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2259 catch
25826
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2260 let caught = v:exception
25761
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2261 endtry
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2262 call assert_equal('yes', caught)
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2263 END
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2264 call writefile(lines, 'XtestThrow')
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2265 source XtestThrow
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2266
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2267 call delete('XtestThrow')
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2268 unlet g:caught
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2269 endfunc
e855eba4ac39 patch 8.2.3416: second error is reported while exception is being thrown
Bram Moolenaar <Bram@vim.org>
parents: 23191
diff changeset
2270
29010
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2271 " Test that after reporting an uncaught exception there is no error for a
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2272 " missing :endif
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2273 func Test_after_exception_no_endif_error()
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2274 function Throw()
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2275 throw "Failure"
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2276 endfunction
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2277
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2278 function Foo()
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2279 if 1
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2280 call Throw()
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2281 endif
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2282 endfunction
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2283 call assert_fails('call Foo()', ['E605:', 'E605:'])
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2284 delfunc Throw
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2285 delfunc Foo
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2286 endfunc
36ef8d453ade patch 8.2.5027: error for missing :endif when an exception was thrown
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
2287
25826
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2288 " Test for using throw in a called function with following endtry {{{1
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2289 func Test_user_command_function_call_with_endtry()
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2290 let lines =<< trim END
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2291 funct s:throw(msg) abort
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2292 throw a:msg
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2293 endfunc
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2294 func s:main() abort
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2295 try
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2296 try
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2297 throw 'err1'
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2298 catch
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2299 call s:throw('err2') | endtry
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2300 catch
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2301 let s:caught = 'yes'
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2302 endtry
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2303 endfunc
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2304
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2305 call s:main()
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2306 call assert_equal('yes', s:caught)
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2307 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30483
diff changeset
2308 call writefile(lines, 'XtestThrow', 'D')
25826
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2309 source XtestThrow
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2310 endfunc
5040fae521f6 patch 8.2.3448: :endtry after function call that throws not found
Bram Moolenaar <Bram@vim.org>
parents: 25761
diff changeset
2311
25872
a58520ab7c3b patch 8.2.3470: crash with error in :catch and also in :finally
Bram Moolenaar <Bram@vim.org>
parents: 25826
diff changeset
2312 func ThisWillFail()
25893
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2313
25872
a58520ab7c3b patch 8.2.3470: crash with error in :catch and also in :finally
Bram Moolenaar <Bram@vim.org>
parents: 25826
diff changeset
2314 endfunc
a58520ab7c3b patch 8.2.3470: crash with error in :catch and also in :finally
Bram Moolenaar <Bram@vim.org>
parents: 25826
diff changeset
2315
25893
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2316 " This was crashing prior to the fix in 8.2.3478.
25872
a58520ab7c3b patch 8.2.3470: crash with error in :catch and also in :finally
Bram Moolenaar <Bram@vim.org>
parents: 25826
diff changeset
2317 func Test_error_in_catch_and_finally()
25893
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2318 let lines =<< trim END
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2319 try
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2320 echo x
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2321 catch
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2322 for l in []
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2323 finally
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2324 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30483
diff changeset
2325 call writefile(lines, 'XtestCatchAndFinally', 'D')
25893
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2326 try
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2327 source XtestCatchAndFinally
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2328 catch /E600:/
51694ef3902e patch 8.2.3480: test does not fail without the fix for a crash
Bram Moolenaar <Bram@vim.org>
parents: 25872
diff changeset
2329 endtry
25872
a58520ab7c3b patch 8.2.3470: crash with error in :catch and also in :finally
Bram Moolenaar <Bram@vim.org>
parents: 25826
diff changeset
2330 endfunc
a58520ab7c3b patch 8.2.3470: crash with error in :catch and also in :finally
Bram Moolenaar <Bram@vim.org>
parents: 25826
diff changeset
2331
25905
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2332 " This was causing an illegal memory access
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2333 func Test_leave_block_in_endtry_not_called()
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2334 let lines =<< trim END
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2335 vim9script
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2336 try #
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2337 for x in []
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2338 if
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2339 endwhile
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2340 if
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2341 endtry
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2342 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30483
diff changeset
2343 call writefile(lines, 'XtestEndtry', 'D')
25905
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2344 try
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2345 source XtestEndtry
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2346 catch /E171:/
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2347 endtry
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2348 endfunc
892f937358ea patch 8.2.3486: illegal memory access with invalid sequence of commands
Bram Moolenaar <Bram@vim.org>
parents: 25893
diff changeset
2349
18886
050f5eaa9e50 patch 8.2.0004: get E685 and E931 if buffer reload is interrupted
Bram Moolenaar <Bram@vim.org>
parents: 18504
diff changeset
2350 " Modeline {{{1
18504
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2351 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker