annotate src/testdir/test_trycatch.vim @ 18504:ece46bd3c9af v8.1.2246

patch 8.1.2246: some tests are still in old style Commit: https://github.com/vim/vim/commit/1f068233c101ecf5966e6df14853fe68f08175a7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 3 16:17:26 2019 +0100 patch 8.1.2246: some tests are still in old style Problem: Some tests are still in old style. Solution: Change a few tests to new style. (Yegappan Lakshmanan)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 Nov 2019 16:30:03 +0100
parents
children 050f5eaa9e50
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
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
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 " Test environment {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 "-------------------------------------------------------------------------------
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 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
12 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
13
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 " 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
15 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " 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
17 " :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
18 " 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
19 "-------------------------------------------------------------------------------
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 func T25_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 if loops >= 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 Xpath 'f' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 Xpath 'g' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 func T25_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 if 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 call T25_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 Xpath 'E'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 func Test_finally()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 call T25_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 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
74 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76
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 " 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
79 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 " 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
81 " 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
82 " :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
83 " 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
84 " :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
85 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 func T26_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 continue
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 finish
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 finally
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 if loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 continue
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 Xpath 'i' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 finish
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 Xpath 'j' . loops
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 'k' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 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
139 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 call T26_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 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
142 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144
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 " 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
147 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 " 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
149 " 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
150 " 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
151 " 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
152 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 func T32_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 Xpath 'a'
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 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 return "ABCD"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 func T32_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 return 8
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 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
179 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 func T32_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 return 32
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 func T32_I()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 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
203 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 func Test_finally_return()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 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
211 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
212 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 " 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
216 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 " 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
218 " 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
219 " 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
220 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 func T33_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 RETURN 10
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 func T33_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 RETURN 20
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 RETURN 30
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 func T33_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 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
247 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 func T33_I()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 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
257 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 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
261 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 func T33_J()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 RETURN 100
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 func T33_K()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 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
281 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 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
285 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 func T33_L()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 RETURN 140
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 func T33_M()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 return
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 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
309 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 func T33_N()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 RETURN 170
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 func T33_O()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 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
320 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 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
323 command! -nargs=? RETURN
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 \ 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
325 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 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
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 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
335 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
336 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
337 delcommand RETURN
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340
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 " 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
343 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 " 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
345 " command.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 func T41_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 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
351 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 func T41_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 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
357 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 func T41_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 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
363 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 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
367 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 call T41_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 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
375 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 call T41_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
380 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
381 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 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
384 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388 call T41_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
390 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
391 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 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
393 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
394
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
395 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
396 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
397
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
398
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 " 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
401 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
402 " 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
403 " 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
404 " 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
405 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
406
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 func T42_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
410
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 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 catch /4711/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
422 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423 catch /^4711$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 catch /\d/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 throw 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 catch /^\d\+$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447 catch /arrgh/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 catch /^arrgh$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
457 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 catch /\l/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 catch /^\l\+$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478 throw "ARRGH"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
479 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480 catch /^arrgh$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 catch /^\carrgh$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
484 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
491 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
492 Xpath 'E'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496 Xpath 'F'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 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
498 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
499 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
500
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
501 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
502 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
503 call T42_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
504 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
505 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
506
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
507
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 " 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
510 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511 " 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
512 " 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
513 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
514
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
515 func T43_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
516 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
517 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
518 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
519 if loops == 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
521 throw "a"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
522 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
523 elseif loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
524 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
525 throw "ab"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
526 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529 throw "abc"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 Xpath 'f' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
531 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532 catch /abc/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533 Xpath 'g' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
534 catch /ab/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
535 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
536 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
537 Xpath 'i' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
538 catch /a/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
539 Xpath 'j' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
540 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
541
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
542 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
546
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 func Test_multi_catch()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
548 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 call T43_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 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
551 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553
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 " 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
556 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
557 " 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
558 " 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
559 " 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
560 " 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
561 " 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
562 " 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
563 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 func T44_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
577 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 catch //
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
587
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 throw ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 catch
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 throw "oops"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 Xpath 'j'
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 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 throw "arrgh"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 Xpath 'm'
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 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 throw "brrr"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 catch /^$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 Xpath 'p'
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 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
620 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
622 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
623
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 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
625
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
627 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
628 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
630 " 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
631 " 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
632 " 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
633 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
634 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
635 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
639 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
640 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 if $VIMNOERRTHROW && v:errmsg != ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 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
643 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 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
645 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 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
648 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
650
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651 let cologne = 4711
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
653 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655 throw "throw cologne"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
656 " 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
657 catch |throw cologne|
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
659 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660 catch /4711/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
661 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
662 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
665 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
666 throw "plus"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 catch +plus+
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
668 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
671 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
672 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673 Xpath 'E'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674 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
675 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
677
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678 func Test_empty_catch()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
679 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680 call T44_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 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
682 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
683
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684
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 " 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
687 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688 " 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
689 " 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
690 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692 func T45_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693 let loops = 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694 while loops > 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 try
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 if loops == 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
700 Xpath 'a' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 throw "a"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
702 Xpath 'b' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 elseif loops == 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704 Xpath 'c' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
705 throw "ab"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 Xpath 'd' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
707 elseif loops == 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
708 Xpath 'e' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
709 throw "abc"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
710 Xpath 'f' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
711 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
712 catch /abc/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
713 Xpath 'g' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
714 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
715 catch /ab/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716 Xpath 'h' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
717 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
718 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
719 Xpath 'i' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
720 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 catch /a/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
722 Xpath 'j' . loops
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
723 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
724
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
725 let loops = loops - 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
726 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
729
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 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
731 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
732 call T45_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
733 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
734 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
735
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736
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 " 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
739 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
740 " 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
741 " :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
742 " 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
743 " 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
744 " executed afterwards.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
745 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
746
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 func T46_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748 let sum = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
751 Xpath 'a'
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 'b'
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 'c'
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 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 throw "ABC"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760 catch /xyz/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
764 if sum != 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
766 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767 let sum = sum + 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770 catch /123/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 catch /321/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 if sum != 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
778 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
779 let sum = sum + 2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
780 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
781 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
782 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
783 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
784 if sum != 3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
785 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
786 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
787 let sum = sum + 4
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
788 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
789 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
790 catch /ABC/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
791 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
792 if sum != 7
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
793 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
794 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
795 let sum = sum + 8
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
796 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
797 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
798 if sum != 15
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
799 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
800 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
801 let sum = sum + 16
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
802 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
803 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
804 if sum != 31
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
805 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
806 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
807 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
808
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
809 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
810 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811 call T46_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 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
813 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815
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 " 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
818 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 " 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
820 " 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
821 " 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
822 " 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
823 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825 func T47_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 Xpath 'b'
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 'c'
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 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833 throw "x1"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
836 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 throw "x2"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
843 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
845 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 throw "x3"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
850 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
851 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
852 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
864 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
865 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
866 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
867 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
868 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
869 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
870 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
871 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
872 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
873 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
874 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
875 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
876 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
877 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
878 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
879 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
880 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
881 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
882 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
883 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
884 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
885
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
886 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
887 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
888 call T47_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
889 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
890 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
891
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
892
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 " 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
895 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
896 " 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
897 " 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
898 " 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
899 " thrown exception is discarded.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
900 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
901
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
902 func T48_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
903 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
904
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 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
907 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
908 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
909 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
910 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
911 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
912 throw "x1"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
913 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
914 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
915 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
916 catch /x1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
917 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
918 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
919 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
920
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
921 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
922 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
923 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
924 throw "x2"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
927 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
928 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
929 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
930 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
931 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
932 throw "x3"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
933 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
934 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
935 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
936 catch /x2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
938 catch /x3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
939 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
940 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
941 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
942
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
943 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
944 try
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 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
947 throw "x4"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
948 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
949 catch /x5/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
950 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
951 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
952 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
953 throw "x5" " discards 'x4'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
954 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
955 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
956 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
957 catch /x4/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
958 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
959 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
960 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
961 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
962 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
963 catch /x5/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
964 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
965 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
966 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
967
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
968 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
969 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
970 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
971 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
972 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
973 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
974
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
975 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
976 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
977 call T48_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
978 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
979 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
980
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
981
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 " 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
984 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
985 " 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
986 " a user command.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
987 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
988
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
989 func T51_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
990 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
991 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
992 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
993 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
994
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
995 try
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 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
999 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1000 THROW1 "A"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1001 catch /A/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1002 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1003 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1004 catch /1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1005 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1007
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1008 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1009 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1010 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1011 THROW2 "B"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1012 catch /B/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1013 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1014 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1015 catch /2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1016 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1017 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1018
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1019 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1020 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1021 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1022 THROW3 "C"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1023 catch /C/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1024 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1025 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1026 catch /3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1027 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1028 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1029
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1030 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1031 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1032 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1033 THROW4 "D"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1034 catch /D/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1035 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1036 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1037 catch /4/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1038 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1039 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1040
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1041 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1042 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1043 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1044 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
1045 catch /E/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1046 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1047 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1048 catch /5/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1049 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1050 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1051
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1052 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1053 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1054 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1055 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
1056 catch /F/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1057 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1058 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1059 catch /6/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1060 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1061 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1062
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1063 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1064 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1065 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1066 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
1067 catch /G/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1068 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1069 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1070 catch /7/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1071 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1072 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1073
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1074 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1075 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1076 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1077 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
1078 catch /H/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1079 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1080 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1081 catch /8/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1082 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1083 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1084
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1085 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1086 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1087 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
1088 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1089
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1090 Xpath 'z'
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 delcommand THROW1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1093 delcommand THROW2
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1094 delcommand THROW3
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1095 delcommand THROW4
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1096 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1097
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1098 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
1099 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1100 call T51_F()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1101 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
1102 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1103
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1104
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 " 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
1108 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1109 " 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
1110 " 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
1111 " caught by the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1112 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1113
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1114 func T69_throw(x)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1115 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1116 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1117 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1118
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1119 func Test_throw_ifelsewhile()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1120 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1121
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1122 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1123 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1124 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1125 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
1126 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1127 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1128 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1129 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1130 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1131 catch /^if$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1132 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1133 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1134 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1135 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
1136 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1137
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1138 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1139 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1140 if v:false
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1141 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1142 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
1143 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1144 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1145 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1146 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1147 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1148 catch /^elseif$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1149 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1150 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1151 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1152 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
1153 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1154
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1155 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1156 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1157 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
1158 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1159 break
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1160 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1161 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1162 catch /^while$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1163 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1164 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1165 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1166 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
1167 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1168 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
1169 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1170 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
1171 catch /.*/
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:exception .. " in " .. v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1173 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1174 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1175
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1176 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
1177 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1178
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1179
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 " 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
1182 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1183 " 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
1184 " 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
1185 " 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
1186 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1187
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1188 let T70_taken = ""
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 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
1191 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
1192 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1193 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1194
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1195 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
1196 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
1197 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
1198 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1199
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1200 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
1201 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
1202 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
1203 return a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1204 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1205
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1206 func Test_throwreturn()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1207 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1208
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1209 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1210 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1211 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1212 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
1213 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1214 catch /^return$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1215 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1216 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1217 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1218 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
1219 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1220
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1221 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1222 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1223 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
1224 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1225 catch /^return-var$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1226 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1227 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1228 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1229 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
1230 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1231 unlet! var
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1232 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1233
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1234 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1235 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1236 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
1237 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1238 catch /^except1/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1239 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1240 catch /^throw1$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1241 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1242 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1243 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1244 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
1245 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1246
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1247 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1248 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1249 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
1250 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1251 catch /^except2/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1252 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1253 catch /^throw2$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1254 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1255 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1256 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1257 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
1258 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1259
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1260 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1261 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1262 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
1263 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1264 catch /^except3/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1265 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1266 catch /^throw3$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1267 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1268 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1269 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1270 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
1271 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1272 unlet! var
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1273 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1274
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1275 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
1276 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1277 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
1278 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1279 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
1280 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1281 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1282 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
1283 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1284
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1285 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
1286 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1287
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1288 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1289 " 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
1290 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1291 " 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
1292 " 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
1293 " 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
1294 " 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
1295 " the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1296 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1297
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1298 let T71_taken = ""
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 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
1301 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
1302 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1303 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1304
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1305 func T71_F(n)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1306 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
1307 return "F" . a:n
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1308 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1309
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1310 func Test_throw_echo()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1311 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1312
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1313 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1314 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1315 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1316 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
1317 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1318 catch /^echo-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1319 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1320 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1321 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1322 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
1323 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1324
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1325 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1326 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1327 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
1328 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1329 catch /^echon-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1330 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1331 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1332 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1333 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
1334 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1335
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1336 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1337 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1338 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
1339 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1340 catch /^echomsg-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1341 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1342 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1343 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1344 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
1345 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1346
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1347 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1348 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1349 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
1350 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1351 catch /^echoerr-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1352 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1353 catch /Vim/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1354 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1355 catch /echoerr/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1356 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1357 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1358 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1359 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
1360 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1361
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1362 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1363 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1364 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
1365 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1366 catch /^execute-except$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1367 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1368 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1369 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1370 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
1371 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1372
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1373 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
1374 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1375 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
1376 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1377 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
1378 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1379 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1380 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
1381 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1382
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1383 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
1384 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1385
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1386
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 " 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
1389 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1390 " 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
1391 " 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
1392 " 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
1393 " 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
1394 " 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
1395 " the script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1396 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1397
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1398 let throwcount = 0
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 func T72_throw(x)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1401 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
1402 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1403 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1404
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1405 let T72_addpath = ''
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 func T72_addpath(p)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1408 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
1409 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1410
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1411 func Test_throw_let()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1412 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1413
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1414 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1415 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1416 let $VAR = 'old_value'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1417 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1418 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
1419 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1420 catch /^var$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1421 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1422 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1423 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
1424 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1425
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1426 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1427 let @a = 'old_value'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1428 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1429 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
1430 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1431 catch /^reg$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1432 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1433 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1434 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
1435 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1436 catch /^REG$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1437 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1438 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1439 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1440 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
1441 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
1442 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1443
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1444 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1445 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
1446 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
1447 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1448 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
1449 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1450 catch /^opt$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1451 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1452 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1453 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
1454 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1455 catch /^gopt$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1456 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1457 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1458 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
1459 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1460 catch /^lopt$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1461 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1462 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1463 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1464 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1465 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
1466 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
1467 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
1468 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
1469 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1470
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1471 unlet! var1 var2 var3
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 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1474 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1475 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
1476 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1477 catch /^var1$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1478 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1479 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1480 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
1481 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1482
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1483 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1484 let var2 = 'old_value'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1485 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1486 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
1487 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1488 catch /^var2$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1489 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1490 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1491 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
1492 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1493
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1494 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1495 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1496 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
1497 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1498 catch /^var3$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1499 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1500 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1501
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1502 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1503 call T72_addpath('T1')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1504 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
1505 call T72_addpath('T4')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1506 catch /^var4$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1507 call T72_addpath('T5')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1508 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1509
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1510 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1511 call T72_addpath('T6')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1512 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
1513 \ | call T72_addpath('T8')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1514 call T72_addpath('T9')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1515 catch /^var5$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1516 call T72_addpath('T10')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1517 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1518
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1519 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
1520 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
1521 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1522 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
1523 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1524
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1525 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
1526 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1527
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1528
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 " 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
1531 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1532 " 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
1533 " 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
1534 " 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
1535 " script.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1536 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1537
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1538 let T73_taken = ''
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 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
1541 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
1542 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1543 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1544
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1545 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
1546 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
1547 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
1548 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
1549 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1550 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
1551 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1552
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1553 func Test_throw_func()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1554 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1555
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1556 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1557 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1558 " Define function.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1559 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1560 function! F0()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1561 endfunction
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1562 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1563 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
1564 endfunction
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1565 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1566 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
1567 endfunction
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1568 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1569 catch /^function-def-ok$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1570 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1571 catch /^function-def$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1572 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1573 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1574 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
1575 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1576
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1577 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1578 " List function.
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1579 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1580 function F0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1581 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1582 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
1583 Xpath 'i'
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', 4)}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1585 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1586 catch /^function-lst-ok$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1587 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1588 catch /^function-lst$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1589 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1590 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1591 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
1592 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1593
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1594 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1595 " Delete function
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1596 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1597 delfunction F0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1598 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1599 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
1600 Xpath 'o'
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', 6)}
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1602 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1603 catch /^function-del-ok$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1604 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1605 catch /^function-del$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1606 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1607 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1608 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
1609 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1610 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
1611 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1612 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
1613 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1614
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1615 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
1616 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1617
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1618
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 " 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
1621 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1622 " 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
1623 " 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
1624 " :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
1625 " 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
1626 " 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
1627 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1628
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1629 let T74_taken = ""
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 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
1632 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
1633 throw a:x
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1634 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1635
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1636 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
1637 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
1638 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
1639 return "EXPR"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1640 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1641
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1642 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
1643 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
1644 let theline = getline(".")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1645 if theline =~ "skip"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1646 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
1647 return 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1648 elseif theline =~ "throw"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1649 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
1650 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
1651 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1652 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
1653 return 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1654 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1655 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1656
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1657 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
1658 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
1659 let theline = getline(".")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1660 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
1661 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
1662 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
1663 elseif theline =~ "throw"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1664 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
1665 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
1666 else
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1667 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
1668 return "replaced"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1669 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1670 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1671
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1672 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
1673 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1674
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1675 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1676 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1677 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1678 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
1679 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1680 catch /^exists1$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1681 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1682 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1683 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
1684 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1685 catch /^exists2$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1686 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1687 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1688 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
1689 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1690 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1691 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
1692 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1693
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1694 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1695 let file = tempname()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1696 exec "edit" file
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1697 call append(0, [
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1698 \ 'begin',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1699 \ 'xx',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1700 \ 'middle 3',
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 5 skip',
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 7 throw',
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 \ 'end'])
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1707 normal! gg
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1708 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1709 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
1710 \ 'T74_skip("searchpair", 3)')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1711 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1712 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
1713 \ 'T74_skip("searchpair", 4)')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1714 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1715 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
1716 \ 'T74_skip("searchpair", 5)')
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1717 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1718 catch /^searchpair[35]$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1719 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1720 catch /^searchpair4$/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1721 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1722 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1723 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
1724 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1725 bwipeout!
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1726 call delete(file)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1727 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1728
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1729 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1730 let file = tempname()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1731 exec "edit" file
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1732 call append(0, [
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1733 \ 'subst 1',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1734 \ 'subst 2',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1735 \ 'not',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1736 \ 'subst 4',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1737 \ 'subst throw',
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1738 \ 'subst 6'])
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1739 normal! gg
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1740 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1741 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
1742 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1743 Xpath 'm'
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 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1746 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
1747 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1748 if v:errmsg != ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1749 " 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
1750 " 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
1751 throw "faked Vim(substitute)"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1752 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1753 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1754 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
1755 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1756 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
1757 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1758 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1759 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1760 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
1761 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1762 catch /^substitute[678]/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1763 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1764 catch /^substitute9/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1765 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1766 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1767 bwipeout!
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1768 call delete(file)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1769 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1770
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1771 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1772 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1773 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
1774 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1775 catch /substitute()y/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1776 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1777 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1778 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
1779 \ . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1780 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1781
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1782 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1783 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1784 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
1785 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1786 catch /substitute()n/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1787 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1788 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1789 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
1790 \ . v:throwpoint)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1791 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1792
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1793 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
1794 \ g:T74_taken)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1795
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1796 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1797 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
1798 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1799
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1800 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
1801 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1802
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1803
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 " 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
1806 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1807 " 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
1808 " 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
1809 " 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
1810 " 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
1811 "
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1812 " 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
1813 " 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
1814 " 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
1815 " 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
1816 " 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
1817 " 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
1818 " 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
1819 " 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
1820 "-------------------------------------------------------------------------------
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1821
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1822 func T75_F1(arg1)
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1823 Xpath 'a'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1824 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1825
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1826 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
1827 Xpath 'b'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1828 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1829
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1830 func T75_G()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1831 Xpath 'c'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1832 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1833
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1834 func T75_H()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1835 Xpath 'd'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1836 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1837
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1838 func T75_R()
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1839 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1840 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1841 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1842 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1843 Xpath 'e'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1844 return append(1, "s")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1845 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1846 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1847 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1848 Xpath 'f'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1849 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1850 Xpath 'g'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1851 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
1852 Xpath 'h'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1853 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1854 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
1855 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1856 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1857 Xpath 'i'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1858 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1859
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1860 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
1861 XpathINIT
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1862
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1863 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1864 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
1865
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1866 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1867 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1868 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1869 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1870 Xpath 'j'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1871 call append(1, "s")
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1872 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1873 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1874 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1875 Xpath 'k'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1876 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1877 Xpath 'l'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1878 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
1879 Xpath 'm'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1880 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1881 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
1882 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1883 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1884
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1885 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1886 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1887 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1888 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1889 Xpath 'n'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1890 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
1891 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1892 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1893 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1894 Xpath 'o'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1895 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1896 Xpath 'p'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1897 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
1898 Xpath 'q'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1899 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1900 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
1901 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1902 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1903
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1904 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1905 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1906 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1907 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1908 Xpath 'r'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1909 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
1910 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1911 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1912 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1913 Xpath 's'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1914 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1915 Xpath 't'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1916 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
1917 Xpath 'u'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1918 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1919 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
1920 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1921 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1922
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1923 call T75_R()
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 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1926 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1927 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1928 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1929 Xpath 'v'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1930 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
1931 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1932 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1933 catch /^T.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1934 Xpath 'w'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1935 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1936 Xpath 'x'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1937 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1938 Xpath 'y'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1939 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
1940 Xpath 'z'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1941 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1942 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
1943 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1944 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1945
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1946 while 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1947 try
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1948 let caught = 0
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1949 let v:errmsg = ""
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1950 Xpath 'A'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1951 let x = "a"
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1952 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
1953 catch /E21/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1954 let caught = 1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1955 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1956 Xpath 'B'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1957 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1958 Xpath 'C'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1959 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
1960 Xpath 'D'
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1961 endif
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1962 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
1963 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
1964 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1965 endwhile
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1966 catch /.*/
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1967 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
1968 finally
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1969 set ma&
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1970 endtry
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1971
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1972 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
1973 endfunc
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1974
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1975 " Modelines {{{1
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1976 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
ece46bd3c9af patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1977 "-------------------------------------------------------------------------------