Mercurial > vim
annotate src/testdir/test_viml.vim @ 7774:656db98806b3 v7.4.1184
commit https://github.com/vim/vim/commit/54e09e71984af6db92f3ad37ce390630a23407af
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 26 23:49:31 2016 +0100
patch 7.4.1184
Problem: MS-Windows build is still broken.
Solution: Change nbsock to ch_fd.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 27 Jan 2016 00:00:05 +0100 |
parents | 3d8e4e0d7127 |
children | d4fec9208e7e |
rev | line source |
---|---|
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test various aspects of the Vim language. |
7627
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
2 " Most of this was formerly in test49. |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " Test environment {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 com! XpathINIT let g:Xpath = '' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args> |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " Append a message to the "messages" file |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 func! Xout(text) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 split messages |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 $put =a:text |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 wq |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endfunc |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 com! -nargs=1 Xout call Xout(<args>) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 " MakeScript() - Make a script file from a function. {{{2 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 " Create a script that consists of the body of the function a:funcname. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 " Replace any ":return" by a ":finish", any argument variable by a global |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 " variable, and and every ":call" by a ":source" for the next following argument |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " in the variable argument list. This function is useful if similar tests are |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " to be made for a ":return" from a function call or a ":finish" in a script |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " file. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 function! MakeScript(funcname, ...) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let script = tempname() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 execute "redir! >" . script |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 execute "function" a:funcname |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 redir END |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 execute "edit" script |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 " Delete the "function" and the "endfunction" lines. Do not include the |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 " word "function" in the pattern since it might be translated if LANG is |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " set. When MakeScript() is being debugged, this deletes also the debugging |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 " output of its line 3 and 4. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 exec '1,/.*' . a:funcname . '(.*)/d' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 /^\d*\s*endfunction\>/,$d |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 %s/^\d*//e |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 %s/return/finish/e |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 %s/\<a:\(\h\w*\)/g:\1/ge |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 normal gg0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 let cnt = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 while search('\<call\s*\%(\u\|s:\)\w*\s*(.*)', 'W') > 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let cnt = cnt + 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 s/\<call\s*\%(\u\|s:\)\w*\s*(.*)/\='source ' . a:{cnt}/ |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 g/^\s*$/d |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 write |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 bwipeout |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 return script |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 " ExecAsScript - Source a temporary script made from a function. {{{2 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 " Make a temporary script file from the function a:funcname, ":source" it, and |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
58 " delete it afterwards. However, if an exception is thrown the file may remain, |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
59 " the caller should call DeleteTheScript() afterwards. |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
60 let s:script_name = '' |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 function! ExecAsScript(funcname) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 " Make a script from the function passed as argument. |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
63 let s:script_name = MakeScript(a:funcname) |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 " Source and delete the script. |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
66 exec "source" s:script_name |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
67 call delete(s:script_name) |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
68 let s:script_name = '' |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
71 function! DeleteTheScript() |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
72 if s:script_name |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
73 call delete(s:script_name) |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
74 let s:script_name = '' |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
75 endif |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
76 endfunc |
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
77 |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 " Test 1: :endwhile in function {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " Detect if a broken loop is (incorrectly) reactivated by the |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 " :endwhile. Use a :return to prevent an endless loop, and make |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 " this test first to get a meaningful result on an error before other |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " tests will hang. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 function! T1_F() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 Xpath 'a' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 let first = 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 while 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 Xpath 'b' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 if first |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 Xpath 'c' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 let first = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 break |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 else |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 Xpath 'd' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 return |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 function! T1_G() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 Xpath 'h' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 let first = 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 while 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 Xpath 'i' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 if first |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 Xpath 'j' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 let first = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 break |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 else |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 Xpath 'k' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 return |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 if 1 " unmatched :if |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 func Test_endwhile_function() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 XpathINIT |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 call T1_F() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 Xpath 'F' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 try |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 call T1_G() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 catch |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 " Catch missing :endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 call assert_true(v:exception =~ 'E171') |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 Xpath 'x' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 endtry |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 Xpath 'G' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 call assert_equal('abcFhijxG', g:Xpath) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 endfunc |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 " Test 2: :endwhile in script {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 " Detect if a broken loop is (incorrectly) reactivated by the |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 " :endwhile. Use a :finish to prevent an endless loop, and place |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 " this test before others that might hang to get a meaningful result |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 " on an error. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 " This test executes the bodies of the functions T1_F and T1_G from |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 " the previous test as script files (:return replaced by :finish). |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 func Test_endwhile_script() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 XpathINIT |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 ExecAsScript T1_F |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 Xpath 'F' |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
156 call DeleteTheScript() |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 try |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 ExecAsScript T1_G |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 catch |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 " Catch missing :endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_true(v:exception =~ 'E171') |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 Xpath 'x' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 endtry |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 Xpath 'G' |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
166 call DeleteTheScript() |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 call assert_equal('abcFhijxG', g:Xpath) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 endfunc |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 " Test 3: :if, :elseif, :while, :continue, :break {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 function Test_if_while() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 XpathINIT |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 if 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 Xpath 'a' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 let loops = 3 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 while loops > -1 " main loop: loops == 3, 2, 1 (which breaks) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 if loops <= 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 let break_err = 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 let loops = -1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 else |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 Xpath 'b' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 if (loops == 2) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 while loops == 2 " dummy loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 Xpath 'c' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 let loops = loops - 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 continue " stop dummy loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 Xpath 'd' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 continue " continue main loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 Xpath 'e' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 elseif (loops == 1) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 let p = 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 while p " dummy loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 Xpath 'f' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 let p = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 break " break dummy loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 Xpath 'g' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 Xpath 'h' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 unlet p |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 break " break main loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 Xpath 'i' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 if (loops > 0) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 Xpath 'j' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 while loops == 3 " dummy loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 let loops = loops - 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 endwhile " end dummy loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 endwhile " end main loop |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 Xpath 'k' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 else |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 Xpath 'l' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 Xpath 'm' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 if exists("break_err") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 Xpath 'm' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 unlet break_err |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 unlet loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 endfunc |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 " Test 4: :return {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 function! T4_F() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 if 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 Xpath 'a' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 let loops = 3 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 while loops > 0 " 3: 2: 1: |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 Xpath 'b' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 if (loops == 2) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 Xpath 'c' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 return |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 Xpath 'd' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 Xpath 'e' . loops |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 let loops = loops - 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 Xpath 'f' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 else |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 Xpath 'g' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 function Test_return() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 XpathINIT |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 call T4_F() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 Xpath '4' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 call assert_equal('ab3e3b2c24', g:Xpath) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 " Test 5: :finish {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
267 " This test executes the body of the function T4_F from the previous |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 " test as a script file (:return replaced by :finish). |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
269 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 function Test_finish() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 XpathINIT |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 ExecAsScript T4_F |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 Xpath '5' |
7763
26bb1a6abe25
commit https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Christian Brabandt <cb@256bit.org>
parents:
7761
diff
changeset
|
275 call DeleteTheScript() |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 call assert_equal('ab3e3b2c25', g:Xpath) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
279 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
280 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
283 " Test 6: Defining functions in :while loops {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 " Functions can be defined inside other functions. An inner function |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 " gets defined when the outer function is executed. Functions may |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
287 " also be defined inside while loops. Expressions in braces for |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 " defining the function name are allowed. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
290 " The functions are defined when sourcing the script, only the |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
291 " resulting path is checked in the test function. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 "------------------------------------------------------------------------------- |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
294 XpathINIT |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 " The command CALL collects the argument of all its invocations in "calls" |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 " when used from a function (that is, when the global variable "calls" needs |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
298 " the "g:" prefix). This is to check that the function code is skipped when |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 " the function is defined. For inner functions, do so only if the outer |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 " function is not being executed. |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 " |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
302 let calls = "" |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
303 com! -nargs=1 CALL |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
304 \ if !exists("calls") && !exists("outer") | |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
305 \ let g:calls = g:calls . <args> | |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
306 \ endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
307 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
308 let i = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 while i < 3 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 let i = i + 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 if i == 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 Xpath 'a' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 function! F1(arg) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 CALL a:arg |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 let outer = 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 let j = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 while j < 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
319 Xpath 'b' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 let j = j + 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 function! G1(arg) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 CALL a:arg |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
324 Xpath 'c' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 Xpath 'd' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 continue |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 Xpath 'e' . i |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 function! F{i}(i, arg) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 CALL a:arg |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 let outer = 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 if a:i == 3 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 Xpath 'f' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 let k = 0 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 while k < 3 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 Xpath 'g' . k |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 let k = k + 1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 function! G{a:i}{k}(arg) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 CALL a:arg |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 Xpath 'h' . k |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 endfunction |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
350 Xpath 'i' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 endwhile |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 if exists("*G1") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 Xpath 'j' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 if exists("*F1") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 call F1("F1") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 if exists("*G1") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 call G1("G1") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 if exists("G21") || exists("G22") || exists("G23") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 Xpath 'k' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 if exists("*F2") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 call F2(2, "F2") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 if exists("*G21") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
370 call G21("G21") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
372 if exists("*G22") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
373 call G22("G22") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 if exists("*G23") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
376 call G23("G23") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
377 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
379 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 if exists("G31") || exists("G32") || exists("G33") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 Xpath 'l' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 if exists("*F3") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 call F3(3, "F3") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 if exists("*G31") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 call G31("G31") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 if exists("*G32") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 call G32("G32") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
390 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 if exists("*G33") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
392 call G33("G33") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 endif |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
395 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 Xpath 'm' |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 let g:test6_result = g:Xpath |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 let g:test6_calls = calls |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 unlet calls |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 delfunction F1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 delfunction G1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 delfunction F2 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 delfunction G21 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 delfunction G22 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 delfunction G23 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 delfunction G31 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 delfunction G32 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 delfunction G33 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 function Test_defining_functions() |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 call assert_equal('ade2ie3ibcg0h1g1h2g2h3fg0h1g1h2g2h3m', g:test6_result) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 call assert_equal('F1G1F2G21G22G23F3G31G32G33', g:test6_calls) |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
415 endfunc |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
416 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
417 "------------------------------------------------------------------------------- |
7454
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
418 " Test 7: Continuing on errors outside functions {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
419 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
420 " On an error outside a function, the script processing continues |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
421 " at the line following the outermost :endif or :endwhile. When not |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
422 " inside an :if or :while, the script processing continues at the next |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
423 " line. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
424 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
425 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
426 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
427 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
428 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
429 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
430 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
431 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
432 asdf |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
433 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
434 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
435 endwhile | Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
436 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
437 endif | Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
438 Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
439 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
440 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
441 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
442 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
443 Xpath 'i' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
444 asdf |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
445 Xpath 'j' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
446 endif | Xpath 'k' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
447 Xpath 'l' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
448 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
449 endwhile | Xpath 'm' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
450 Xpath 'n' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
451 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
452 asdf |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
453 Xpath 'o' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
454 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
455 asdf | Xpath 'p' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
456 Xpath 'q' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
457 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
458 let g:test7_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
459 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
460 func Test_error_in_script() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
461 call assert_equal('abghinoq', g:test7_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
462 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
463 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
464 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
465 " Test 8: Aborting and continuing on errors inside functions {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
466 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
467 " On an error inside a function without the "abort" attribute, the |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
468 " script processing continues at the next line (unless the error was |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
469 " in a :return command). On an error inside a function with the |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
470 " "abort" attribute, the function is aborted and the script processing |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
471 " continues after the function call; the value -1 is returned then. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
472 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
473 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
474 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
475 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
476 function! T8_F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
477 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
478 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
479 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
480 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
481 asdf |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
482 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
483 asdf | Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
484 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
485 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
486 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
487 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
488 endif | Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
489 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
490 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
491 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
492 Xpath 'i' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
493 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
494 Xpath 'j' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
495 asdf |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
496 Xpath 'k' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
497 asdf | Xpath 'l' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
498 Xpath 'm' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
499 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
500 Xpath 'n' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
501 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
502 endwhile | Xpath 'o' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
503 Xpath 'p' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
504 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
505 return novar " returns (default return value 0) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
506 Xpath 'q' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
507 return 1 " not reached |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
508 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
509 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
510 function! T8_G() abort |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
511 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
512 Xpath 'r' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
513 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
514 Xpath 's' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
515 asdf " returns -1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
516 Xpath 't' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
517 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
518 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
519 Xpath 'v' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
520 endif | Xpath 'w' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
521 Xpath 'x' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
522 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
523 return -4 " not reached |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
524 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
525 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
526 function! T8_H() abort |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
527 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
528 Xpath 'A' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
529 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
530 Xpath 'B' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
531 asdf " returns -1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
532 Xpath 'C' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
533 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
534 Xpath 'D' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
535 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
536 endwhile | Xpath 'E' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
537 Xpath 'F' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
538 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
539 return -4 " not reached |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
540 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
541 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
542 " Aborted functions (T8_G and T8_H) return -1. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
543 let g:test8_sum = (T8_F() + 1) - 4 * T8_G() - 8 * T8_H() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
544 Xpath 'X' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
545 let g:test8_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
546 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
547 func Test_error_in_function() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
548 call assert_equal(13, g:test8_sum) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
549 call assert_equal('abcefghijkmnoprsABX', g:test8_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
550 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
551 delfunction T8_F |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
552 delfunction T8_G |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
553 delfunction T8_H |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
554 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
555 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
556 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
557 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
558 " Test 9: Continuing after aborted functions {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
559 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
560 " When a function with the "abort" attribute is aborted due to an |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
561 " error, the next function back in the call hierarchy without an |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
562 " "abort" attribute continues; the value -1 is returned then. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
563 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
564 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
565 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
566 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
567 function! F() abort |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
568 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
569 let result = G() " not aborted |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
570 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
571 if result != 2 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
572 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
573 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
574 return 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
575 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
576 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
577 function! G() " no abort attribute |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
578 Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
579 if H() != -1 " aborted |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
580 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
581 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
582 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
583 return 2 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
584 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
585 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
586 function! H() abort |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
587 Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
588 call I() " aborted |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
589 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
590 return 4 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
591 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
592 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
593 function! I() abort |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
594 Xpath 'i' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
595 asdf " error |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
596 Xpath 'j' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
597 return 8 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
598 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
599 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
600 if F() != 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
601 Xpath 'k' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
602 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
603 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
604 let g:test9_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
605 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
606 delfunction F |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
607 delfunction G |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
608 delfunction H |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
609 delfunction I |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
610 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
611 func Test_func_abort() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
612 call assert_equal('adgifb', g:test9_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
613 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
614 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
615 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
616 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
617 " Test 10: :if, :elseif, :while argument parsing {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
618 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
619 " A '"' or '|' in an argument expression must not be mixed up with |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
620 " a comment or a next command after a bar. Parsing errors should |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
621 " be recognized. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
622 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
623 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
624 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
625 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
626 function! MSG(enr, emsg) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
627 let english = v:lang == "C" || v:lang =~ '^[Ee]n' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
628 if a:enr == "" |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
629 Xout "TODO: Add message number for:" a:emsg |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
630 let v:errmsg = ":" . v:errmsg |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
631 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
632 let match = 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
633 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
634 let match = 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
635 if v:errmsg == "" |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
636 Xout "Message missing." |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
637 else |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
638 let v:errmsg = escape(v:errmsg, '"') |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
639 Xout "Unexpected message:" v:errmsg |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
640 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
641 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
642 return match |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
643 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
644 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
645 if 1 || strlen("\"") | Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
646 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
647 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
648 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
649 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
650 if 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
651 elseif 1 || strlen("\"") | Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
652 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
653 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
654 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
655 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
656 while 1 || strlen("\"") | Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
657 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
658 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
659 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
660 Xpath 'i' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
661 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
662 let v:errmsg = "" |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
663 if 1 ||| strlen("\"") | Xpath 'j' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
664 Xpath 'k' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
665 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
666 Xpath 'l' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
667 if !MSG('E15', "Invalid expression") |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
668 Xpath 'm' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
669 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
670 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
671 let v:errmsg = "" |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
672 if 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
673 elseif 1 ||| strlen("\"") | Xpath 'n' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
674 Xpath 'o' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
675 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
676 Xpath 'p' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
677 if !MSG('E15', "Invalid expression") |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
678 Xpath 'q' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
679 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
680 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
681 let v:errmsg = "" |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
682 while 1 ||| strlen("\"") | Xpath 'r' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
683 Xpath 's' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
684 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
685 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
686 Xpath 't' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
687 if !MSG('E15', "Invalid expression") |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
688 Xpath 'u' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
689 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
690 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
691 let g:test10_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
692 delfunction MSG |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
693 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
694 func Test_expr_parsing() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
695 call assert_equal('abcdefghilpt', g:test10_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
696 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
697 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
698 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
699 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
700 " Test 11: :if, :elseif, :while argument evaluation after abort {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
701 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
702 " When code is skipped over due to an error, the boolean argument to |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
703 " an :if, :elseif, or :while must not be evaluated. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
704 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
705 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
706 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
707 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
708 let calls = 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
709 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
710 function! P(num) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
711 let g:calls = g:calls + a:num " side effect on call |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
712 return 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
713 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
714 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
715 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
716 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
717 asdf " error |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
718 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
719 if P(1) " should not be called |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
720 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
721 elseif !P(2) " should not be called |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
722 Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
723 else |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
724 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
725 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
726 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
727 while P(4) " should not be called |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
728 Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
729 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
730 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
731 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
732 Xpath 'x' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
733 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
734 let g:test11_calls = calls |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
735 let g:test11_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
736 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
737 unlet calls |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
738 delfunction P |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
739 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
740 func Test_arg_abort() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
741 call assert_equal(0, g:test11_calls) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
742 call assert_equal('ax', g:test11_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
743 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
744 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
745 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
746 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
747 " Test 12: Expressions in braces in skipped code {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
748 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
749 " In code skipped over due to an error or inactive conditional, |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
750 " an expression in braces as part of a variable or function name |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
751 " should not be evaluated. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
752 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
753 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
754 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
755 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
756 function! NULL() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
757 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
758 return 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
759 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
760 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
761 function! ZERO() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
762 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
763 return 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
764 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
765 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
766 function! F0() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
767 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
768 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
769 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
770 function! F1(arg) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
771 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
772 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
773 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
774 let V0 = 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
775 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
776 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
777 echo 0 ? F{NULL() + V{ZERO()}}() : 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
778 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
779 Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
780 if 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
781 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
782 call F{NULL() + V{ZERO()}}() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
783 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
784 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
785 Xpath 'i' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
786 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
787 asdf " error |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
788 Xpath 'j' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
789 call F1(F{NULL() + V{ZERO()}}()) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
790 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
791 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
792 Xpath 'k' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
793 if 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
794 asdf " error |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
795 Xpath 'l' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
796 call F{NULL() + V{ZERO()}}() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
797 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
798 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
799 let g:test12_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
800 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
801 func Test_braces_skipped() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
802 call assert_equal('fgik', g:test12_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
803 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
804 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
805 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
806 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
807 " Test 13: Failure in argument evaluation for :while {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
808 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
809 " A failure in the expression evaluation for the condition of a :while |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
810 " causes the whole :while loop until the matching :endwhile being |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
811 " ignored. Continuation is at the next following line. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
812 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
813 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
814 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
815 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
816 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
817 while asdf |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
818 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
819 while 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
820 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
821 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
822 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
823 Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
824 break |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
825 endwhile |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
826 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
827 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
828 while asdf | Xpath 'f' | endwhile | Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
829 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
830 let g:test13_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
831 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
832 func Test_while_fail() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
833 call assert_equal('aeh', g:test13_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
834 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
835 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
836 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
837 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
838 " Test 14: Failure in argument evaluation for :if {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
839 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
840 " A failure in the expression evaluation for the condition of an :if |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
841 " does not cause the corresponding :else or :endif being matched to |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
842 " a previous :if/:elseif. Neither of both branches of the failed :if |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
843 " are executed. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
844 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
845 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
846 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
847 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
848 function! F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
849 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
850 let x = 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
851 if x " false |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
852 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
853 elseif !x " always true |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
854 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
855 let x = 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
856 if g:boolvar " possibly undefined |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
857 Xpath 'd' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
858 else |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
859 Xpath 'e' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
860 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
861 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
862 elseif x " never executed |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
863 Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
864 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
865 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
866 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
867 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
868 let boolvar = 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
869 call F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
870 Xpath '-' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
871 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
872 unlet boolvar |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
873 call F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
874 let g:test14_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
875 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
876 delfunction F |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
877 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
878 func Test_if_fail() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
879 call assert_equal('acdfh-acfh', g:test14_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
880 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
881 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
882 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
883 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
884 " Test 15: Failure in argument evaluation for :if (bar) {{{1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
885 " |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
886 " Like previous test, except that the failing :if ... | ... | :endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
887 " is in a single line. |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
888 "------------------------------------------------------------------------------- |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
889 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
890 XpathINIT |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
891 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
892 function! F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
893 Xpath 'a' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
894 let x = 0 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
895 if x " false |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
896 Xpath 'b' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
897 elseif !x " always true |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
898 Xpath 'c' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
899 let x = 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
900 if g:boolvar | Xpath 'd' | else | Xpath 'e' | endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
901 Xpath 'f' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
902 elseif x " never executed |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
903 Xpath 'g' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
904 endif |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
905 Xpath 'h' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
906 endfunction |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
907 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
908 let boolvar = 1 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
909 call F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
910 Xpath '-' |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
911 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
912 unlet boolvar |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
913 call F() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
914 let g:test15_result = g:Xpath |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
915 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
916 delfunction F |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
917 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
918 func Test_if_bar_fail() |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
919 call assert_equal('acdfh-acfh', g:test15_result) |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
920 endfunc |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
921 |
7627
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
922 "------------------------------------------------------------------------------- |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
923 " Test 90: Recognizing {} in variable name. {{{1 |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
924 "------------------------------------------------------------------------------- |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
925 |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
926 func Test_curlies() |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
927 let s:var = 66 |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
928 let ns = 's' |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
929 call assert_equal(66, {ns}:var) |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
930 |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
931 let g:a = {} |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
932 let g:b = 't' |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
933 let g:a[g:b] = 77 |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
934 call assert_equal(77, g:a['t']) |
d9ec7d22494d
commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents:
7454
diff
changeset
|
935 endfunc |
7454
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
936 |
4ff843da79fd
commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents:
7393
diff
changeset
|
937 "------------------------------------------------------------------------------- |
7718
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
938 " Test 91: using type(). {{{1 |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
939 "------------------------------------------------------------------------------- |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
940 |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
941 func Test_type() |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
942 call assert_equal(0, type(0)) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
943 call assert_equal(1, type("")) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
944 call assert_equal(2, type(function("tr"))) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
945 call assert_equal(3, type([])) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
946 call assert_equal(4, type({})) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
947 call assert_equal(5, type(0.0)) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
948 call assert_equal(6, type(v:false)) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
949 call assert_equal(6, type(v:true)) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
950 call assert_equal(7, type(v:none)) |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
951 call assert_equal(7, type(v:null)) |
7730
80ce794827c4
commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents:
7718
diff
changeset
|
952 |
80ce794827c4
commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents:
7718
diff
changeset
|
953 call assert_equal(0, 0 + v:false) |
80ce794827c4
commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents:
7718
diff
changeset
|
954 call assert_equal(1, 0 + v:true) |
80ce794827c4
commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents:
7718
diff
changeset
|
955 call assert_equal(0, 0 + v:none) |
80ce794827c4
commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents:
7718
diff
changeset
|
956 call assert_equal(0, 0 + v:null) |
80ce794827c4
commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents:
7718
diff
changeset
|
957 |
7740
00fc76e6bd99
commit https://github.com/vim/vim/commit/f48aa160fdd7b8caa7678e1a2139244dd2bdc547
Christian Brabandt <cb@256bit.org>
parents:
7738
diff
changeset
|
958 call assert_equal('v:false', '' . v:false) |
00fc76e6bd99
commit https://github.com/vim/vim/commit/f48aa160fdd7b8caa7678e1a2139244dd2bdc547
Christian Brabandt <cb@256bit.org>
parents:
7738
diff
changeset
|
959 call assert_equal('v:true', '' . v:true) |
00fc76e6bd99
commit https://github.com/vim/vim/commit/f48aa160fdd7b8caa7678e1a2139244dd2bdc547
Christian Brabandt <cb@256bit.org>
parents:
7738
diff
changeset
|
960 call assert_equal('v:none', '' . v:none) |
00fc76e6bd99
commit https://github.com/vim/vim/commit/f48aa160fdd7b8caa7678e1a2139244dd2bdc547
Christian Brabandt <cb@256bit.org>
parents:
7738
diff
changeset
|
961 call assert_equal('v:null', '' . v:null) |
7732
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
962 |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
963 call assert_true(v:false == 0) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
964 call assert_false(v:false != 0) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
965 call assert_true(v:true == 1) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
966 call assert_false(v:true != 1) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
967 call assert_false(v:true == v:false) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
968 call assert_true(v:true != v:false) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
969 |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
970 call assert_true(v:null == 0) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
971 call assert_false(v:null != 0) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
972 call assert_true(v:none == 0) |
4a4f1dd1abe8
commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents:
7730
diff
changeset
|
973 call assert_false(v:none != 0) |
7738
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
974 |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
975 call assert_true(v:false is v:false) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
976 call assert_true(v:true is v:true) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
977 call assert_true(v:none is v:none) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
978 call assert_true(v:null is v:null) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
979 |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
980 call assert_false(v:false isnot v:false) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
981 call assert_false(v:true isnot v:true) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
982 call assert_false(v:none isnot v:none) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
983 call assert_false(v:null isnot v:null) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
984 |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
985 call assert_false(v:false is 0) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
986 call assert_false(v:true is 1) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
987 call assert_false(v:true is v:false) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
988 call assert_false(v:none is 0) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
989 call assert_false(v:null is 0) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
990 call assert_false(v:null is v:none) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
991 |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
992 call assert_true(v:false isnot 0) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
993 call assert_true(v:true isnot 1) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
994 call assert_true(v:true isnot v:false) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
995 call assert_true(v:none isnot 0) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
996 call assert_true(v:null isnot 0) |
598a96d35a0e
commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents:
7732
diff
changeset
|
997 call assert_true(v:null isnot v:none) |
7751
d6e62c739839
commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a
Christian Brabandt <cb@256bit.org>
parents:
7740
diff
changeset
|
998 |
d6e62c739839
commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a
Christian Brabandt <cb@256bit.org>
parents:
7740
diff
changeset
|
999 call assert_equal(v:false, eval(string(v:false))) |
d6e62c739839
commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a
Christian Brabandt <cb@256bit.org>
parents:
7740
diff
changeset
|
1000 call assert_equal(v:true, eval(string(v:true))) |
d6e62c739839
commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a
Christian Brabandt <cb@256bit.org>
parents:
7740
diff
changeset
|
1001 call assert_equal(v:none, eval(string(v:none))) |
d6e62c739839
commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a
Christian Brabandt <cb@256bit.org>
parents:
7740
diff
changeset
|
1002 call assert_equal(v:null, eval(string(v:null))) |
7761
db5864658024
commit https://github.com/vim/vim/commit/767d8c1a1ae762ecf47297c168b8c23caf05d30a
Christian Brabandt <cb@256bit.org>
parents:
7751
diff
changeset
|
1003 |
db5864658024
commit https://github.com/vim/vim/commit/767d8c1a1ae762ecf47297c168b8c23caf05d30a
Christian Brabandt <cb@256bit.org>
parents:
7751
diff
changeset
|
1004 call assert_true(empty(v:false)) |
db5864658024
commit https://github.com/vim/vim/commit/767d8c1a1ae762ecf47297c168b8c23caf05d30a
Christian Brabandt <cb@256bit.org>
parents:
7751
diff
changeset
|
1005 call assert_false(empty(v:true)) |
db5864658024
commit https://github.com/vim/vim/commit/767d8c1a1ae762ecf47297c168b8c23caf05d30a
Christian Brabandt <cb@256bit.org>
parents:
7751
diff
changeset
|
1006 call assert_true(empty(v:null)) |
db5864658024
commit https://github.com/vim/vim/commit/767d8c1a1ae762ecf47297c168b8c23caf05d30a
Christian Brabandt <cb@256bit.org>
parents:
7751
diff
changeset
|
1007 call assert_true(empty(v:none)) |
7768
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1008 |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1009 func ChangeYourMind() |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1010 try |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1011 return v:true |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1012 finally |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1013 return 'something else' |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1014 endtry |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1015 endfunc |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1016 |
3d8e4e0d7127
commit https://github.com/vim/vim/commit/6650a694547eb744afa060ec62dd8270e99db9f2
Christian Brabandt <cb@256bit.org>
parents:
7763
diff
changeset
|
1017 call ChangeYourMind() |
7718
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
1018 endfunc |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
1019 |
6ebd8bdf41bc
commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents:
7627
diff
changeset
|
1020 "------------------------------------------------------------------------------- |
7393
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1021 " Modelines {{{1 |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1022 " vim: ts=8 sw=4 tw=80 fdm=marker |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 " vim: fdt=substitute(substitute(foldtext(),\ '\\%(^+--\\)\\@<=\\(\\s*\\)\\(.\\{-}\\)\:\ \\%(\"\ \\)\\=\\(Test\ \\d*\\)\:\\s*',\ '\\3\ (\\2)\:\ \\1',\ \"\"),\ '\\(Test\\s*\\)\\(\\d\\)\\D\\@=',\ '\\1\ \\2',\ "") |
467b7c511585
commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 "------------------------------------------------------------------------------- |