annotate src/testdir/test_viml.vim @ 7751:d6e62c739839 v7.4.1173

commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 24 21:51:57 2016 +0100 patch 7.4.1173 Problem: No test for new behavior of v:true et al. Solution: Add a test.
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Jan 2016 22:00:05 +0100
parents 00fc76e6bd99
children db5864658024
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 " delete it afterwards.
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 function! ExecAsScript(funcname)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 " Make a script from the function passed as argument.
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 let script = MakeScript(a:funcname)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 " Source and delete the script.
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 exec "source" script
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call delete(script)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 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
69
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 " Test 1: :endwhile in function {{{1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 "
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 " 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
75 " :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
76 " 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
77 " tests will hang.
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 "-------------------------------------------------------------------------------
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 function! T1_F()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 Xpath 'a'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 let first = 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 while 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 Xpath 'b'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 if first
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 Xpath 'c'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 let first = 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 break
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 else
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 Xpath 'd'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 return
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 function! T1_G()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 Xpath 'h'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 let first = 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 while 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 Xpath 'i'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 if first
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 Xpath 'j'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 let first = 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 break
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 else
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 Xpath 'k'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 return
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 if 1 " unmatched :if
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 func Test_endwhile_function()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 XpathINIT
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call T1_F()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 Xpath 'F'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 try
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call T1_G()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 catch
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 " Catch missing :endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_true(v:exception =~ 'E171')
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 Xpath 'x'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 endtry
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 Xpath 'G'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal('abcFhijxG', g:Xpath)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 endfunc
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 " Test 2: :endwhile in script {{{1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 "
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 " 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
134 " :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
135 " 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
136 " on an error.
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 "
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 " 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
139 " 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
140 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 func Test_endwhile_script()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 XpathINIT
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 ExecAsScript T1_F
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 Xpath 'F'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 try
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 ExecAsScript T1_G
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 catch
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 " Catch missing :endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_true(v:exception =~ 'E171')
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 Xpath 'x'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 endtry
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 Xpath 'G'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal('abcFhijxG', g:Xpath)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 endfunc
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 " 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
161 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 function Test_if_while()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 XpathINIT
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 if 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 Xpath 'a'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 let loops = 3
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 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
169 if loops <= 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 let break_err = 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 let loops = -1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 else
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 Xpath 'b' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 if (loops == 2)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 while loops == 2 " dummy loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 Xpath 'c' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 let loops = loops - 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 continue " stop dummy loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 Xpath 'd' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 continue " continue main loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 Xpath 'e' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 elseif (loops == 1)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 let p = 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 while p " dummy loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 Xpath 'f' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 let p = 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 break " break dummy loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 Xpath 'g' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 Xpath 'h' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 unlet p
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 break " break main loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 Xpath 'i' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 if (loops > 0)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 Xpath 'j' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 while loops == 3 " dummy loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 let loops = loops - 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 endwhile " end dummy loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 endwhile " end main loop
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 Xpath 'k'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 else
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 Xpath 'l'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 Xpath 'm'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 if exists("break_err")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 Xpath 'm'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 unlet break_err
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 unlet loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 endfunc
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 " Test 4: :return {{{1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 function! T4_F()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 if 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 Xpath 'a'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 let loops = 3
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 while loops > 0 " 3: 2: 1:
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 Xpath 'b' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 if (loops == 2)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 Xpath 'c' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 return
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 Xpath 'd' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 Xpath 'e' . loops
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 let loops = loops - 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 Xpath 'f'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 else
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 Xpath 'g'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 function Test_return()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 XpathINIT
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 call T4_F()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 Xpath '4'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 call assert_equal('ab3e3b2c24', g:Xpath)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 " Test 5: :finish {{{1
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 " 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
256 " 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
257 "-------------------------------------------------------------------------------
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 function Test_finish()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 XpathINIT
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 ExecAsScript T4_F
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 Xpath '5'
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 call assert_equal('ab3e3b2c25', g:Xpath)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 endfunction
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
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268
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 " 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
271 "
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 " 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
273 " 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
274 " 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
275 " defining the function name are allowed.
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 " 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
278 " 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
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 XpathINIT
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 " 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
284 " 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
285 " 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
286 " 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
287 " function is not being executed.
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 "
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 let calls = ""
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 com! -nargs=1 CALL
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 \ if !exists("calls") && !exists("outer") |
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 \ let g:calls = g:calls . <args> |
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 \ endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 let i = 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 while i < 3
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 let i = i + 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 if i == 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 Xpath 'a'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300 function! F1(arg)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 CALL a:arg
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 let outer = 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 let j = 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 while j < 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 Xpath 'b'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 let j = j + 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 function! G1(arg)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 CALL a:arg
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 Xpath 'c'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 Xpath 'd'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 continue
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319 Xpath 'e' . i
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320 function! F{i}(i, arg)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 CALL a:arg
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
322 let outer = 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
323
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
324 if a:i == 3
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
325 Xpath 'f'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 let k = 0
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 while k < 3
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 Xpath 'g' . k
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330 let k = k + 1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 function! G{a:i}{k}(arg)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332 CALL a:arg
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 Xpath 'h' . k
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
335 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
336 endfunction
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
337 Xpath 'i'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
339 endwhile
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 if exists("*G1")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
342 Xpath 'j'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 if exists("*F1")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345 call F1("F1")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
346 if exists("*G1")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347 call G1("G1")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 if exists("G21") || exists("G22") || exists("G23")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 Xpath 'k'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 if exists("*F2")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 call F2(2, "F2")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 if exists("*G21")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 call G21("G21")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
359 if exists("*G22")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 call G22("G22")
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 if exists("*G23")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
363 call G23("G23")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
364 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
365 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 if exists("G31") || exists("G32") || exists("G33")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368 Xpath 'l'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 if exists("*F3")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 call F3(3, "F3")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 if exists("*G31")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373 call G31("G31")
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("*G32")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376 call G32("G32")
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 if exists("*G33")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
379 call G33("G33")
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
380 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
381 endif
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
383 Xpath 'm'
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
385 let g:test6_result = g:Xpath
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 let g:test6_calls = calls
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388 unlet calls
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389 delfunction F1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 delfunction G1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 delfunction F2
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392 delfunction G21
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 delfunction G22
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 delfunction G23
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 delfunction G31
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 delfunction G32
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 delfunction G33
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399 function Test_defining_functions()
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 call assert_equal('ade2ie3ibcg0h1g1h2g2h3fg0h1g1h2g2h3m', g:test6_result)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 call assert_equal('F1G1F2G21G22G23F3G31G32G33', g:test6_calls)
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 endfunc
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 "-------------------------------------------------------------------------------
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
405 " 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
406 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
407 " 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
408 " 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
409 " 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
410 " line.
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
411 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
412
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
413 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
414
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
415 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
416 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
417 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
418 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
419 asdf
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
420 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
421 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
422 endwhile | Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
423 Xpath 'e'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
424 endif | Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
425 Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
426
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
427 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
428 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
429 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
430 Xpath 'i'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
431 asdf
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
432 Xpath 'j'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
433 endif | Xpath 'k'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
434 Xpath 'l'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
435 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
436 endwhile | Xpath 'm'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
437 Xpath 'n'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
438
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
439 asdf
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
440 Xpath 'o'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
441
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
442 asdf | Xpath 'p'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
443 Xpath 'q'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
444
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
445 let g:test7_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
446
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
447 func Test_error_in_script()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
448 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
449 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
450
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 " 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
453 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
454 " 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
455 " 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
456 " 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
457 " "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
458 " 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
459 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
460
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
461 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
462
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
463 function! T8_F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
464 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
465 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
466 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
467 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
468 asdf
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
469 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
470 asdf | Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
471 Xpath 'e'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
472 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
473 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
474 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
475 endif | Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
476 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
477
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
478 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
479 Xpath 'i'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
480 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
481 Xpath 'j'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
482 asdf
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
483 Xpath 'k'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
484 asdf | Xpath 'l'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
485 Xpath 'm'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
486 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
487 Xpath 'n'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
488 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
489 endwhile | Xpath 'o'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
490 Xpath 'p'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
491
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
492 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
493 Xpath 'q'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
494 return 1 " not reached
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
495 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
496
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
497 function! T8_G() abort
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
498 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
499 Xpath 'r'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
500 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
501 Xpath 's'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
502 asdf " returns -1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
503 Xpath 't'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
504 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
505 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
506 Xpath 'v'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
507 endif | Xpath 'w'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
508 Xpath 'x'
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 return -4 " not reached
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
511 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
512
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
513 function! T8_H() abort
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
514 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
515 Xpath 'A'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
516 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
517 Xpath 'B'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
518 asdf " returns -1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
519 Xpath 'C'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
520 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
521 Xpath 'D'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
522 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
523 endwhile | Xpath 'E'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
524 Xpath 'F'
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 return -4 " not reached
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
527 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
528
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
529 " 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
530 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
531 Xpath 'X'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
532 let g:test8_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
533
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
534 func Test_error_in_function()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
535 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
536 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
537
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
538 delfunction T8_F
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
539 delfunction T8_G
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
540 delfunction T8_H
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
541 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
542
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
543
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
544 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
545 " 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
546 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
547 " 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
548 " 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
549 " "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
550 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
551
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
552 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
553
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
554 function! F() abort
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
555 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
556 let result = G() " not aborted
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
557 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
558 if result != 2
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
559 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
560 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
561 return 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
562 endfunction
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 function! G() " no abort attribute
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
565 Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
566 if H() != -1 " aborted
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
567 Xpath 'e'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
568 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
569 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
570 return 2
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
571 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
572
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
573 function! H() abort
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
574 Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
575 call I() " aborted
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
576 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
577 return 4
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
578 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
579
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
580 function! I() abort
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
581 Xpath 'i'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
582 asdf " error
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
583 Xpath 'j'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
584 return 8
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
585 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
586
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
587 if F() != 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
588 Xpath 'k'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
589 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
590
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
591 let g:test9_result = g:Xpath
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 delfunction F
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
594 delfunction G
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
595 delfunction H
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
596 delfunction I
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
597
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
598 func Test_func_abort()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
599 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
600 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
601
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
602
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 " 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
605 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
606 " 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
607 " 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
608 " be recognized.
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
609 "-------------------------------------------------------------------------------
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 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
612
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
613 function! MSG(enr, emsg)
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
614 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
615 if a:enr == ""
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
616 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
617 let v:errmsg = ":" . v:errmsg
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
618 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
619 let match = 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
620 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
621 let match = 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
622 if v:errmsg == ""
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
623 Xout "Message missing."
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
624 else
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
625 let v:errmsg = escape(v:errmsg, '"')
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
626 Xout "Unexpected message:" v:errmsg
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
627 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
628 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
629 return match
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
630 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
631
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
632 if 1 || strlen("\"") | Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
633 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
634 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
635 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
636
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
637 if 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
638 elseif 1 || strlen("\"") | Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
639 Xpath 'e'
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 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
642
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
643 while 1 || strlen("\"") | Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
644 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
645 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
646 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
647 Xpath 'i'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
648
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
649 let v:errmsg = ""
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
650 if 1 ||| strlen("\"") | Xpath 'j'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
651 Xpath 'k'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
652 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
653 Xpath 'l'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
654 if !MSG('E15', "Invalid expression")
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
655 Xpath 'm'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
656 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
657
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
658 let v:errmsg = ""
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
659 if 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
660 elseif 1 ||| strlen("\"") | Xpath 'n'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
661 Xpath 'o'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
662 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
663 Xpath 'p'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
664 if !MSG('E15', "Invalid expression")
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
665 Xpath 'q'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
666 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
667
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
668 let v:errmsg = ""
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
669 while 1 ||| strlen("\"") | Xpath 'r'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
670 Xpath 's'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
671 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
672 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
673 Xpath 't'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
674 if !MSG('E15', "Invalid expression")
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
675 Xpath 'u'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
676 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
677
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
678 let g:test10_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
679 delfunction MSG
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 func Test_expr_parsing()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
682 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
683 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
684
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
685
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
686 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
687 " 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
688 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
689 " 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
690 " 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
691 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
692
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
693 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
694
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
695 let calls = 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
696
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
697 function! P(num)
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
698 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
699 return 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
700 endfunction
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 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
703 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
704 asdf " error
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
705 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
706 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
707 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
708 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
709 Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
710 else
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
711 Xpath 'e'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
712 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
713 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
714 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
715 Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
716 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
717 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
718 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
719 Xpath 'x'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
720
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
721 let g:test11_calls = calls
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
722 let g:test11_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
723
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
724 unlet calls
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
725 delfunction P
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
726
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
727 func Test_arg_abort()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
728 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
729 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
730 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
731
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
732
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 " 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
735 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
736 " 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
737 " 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
738 " should not be evaluated.
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
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
741 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
742
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
743 function! NULL()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
744 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
745 return 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
746 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
747
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
748 function! ZERO()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
749 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
750 return 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
751 endfunction
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 function! F0()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
754 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
755 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
756
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
757 function! F1(arg)
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
758 Xpath 'e'
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 let V0 = 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
762
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
763 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
764 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
765
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
766 Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
767 if 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
768 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
769 call F{NULL() + V{ZERO()}}()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
770 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
771
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
772 Xpath 'i'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
773 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
774 asdf " error
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
775 Xpath 'j'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
776 call F1(F{NULL() + V{ZERO()}}())
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
777 endif
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 'k'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
780 if 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
781 asdf " error
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
782 Xpath 'l'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
783 call F{NULL() + V{ZERO()}}()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
784 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
785
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
786 let g:test12_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
787
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
788 func Test_braces_skipped()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
789 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
790 endfunc
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
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
793 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
794 " 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
795 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
796 " 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
797 " 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
798 " 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
799 "-------------------------------------------------------------------------------
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 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
802
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
803 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
804 while asdf
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
805 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
806 while 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
807 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
808 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
809 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
810 Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
811 break
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
812 endwhile
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
813 Xpath 'e'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
814
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
815 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
816 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
817 let g:test13_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
818
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
819 func Test_while_fail()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
820 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
821 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
822
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
823
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
824 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
825 " 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
826 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
827 " 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
828 " 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
829 " 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
830 " are executed.
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
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
833 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
834
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
835 function! F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
836 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
837 let x = 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
838 if x " false
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
839 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
840 elseif !x " always true
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
841 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
842 let x = 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
843 if g:boolvar " possibly undefined
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
844 Xpath 'd'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
845 else
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
846 Xpath 'e'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
847 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
848 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
849 elseif x " never executed
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
850 Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
851 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
852 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
853 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
854
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
855 let boolvar = 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
856 call F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
857 Xpath '-'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
858
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
859 unlet boolvar
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
860 call F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
861 let g:test14_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
862
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
863 delfunction F
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
864
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
865 func Test_if_fail()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
866 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
867 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
868
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
869
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
870 "-------------------------------------------------------------------------------
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
871 " 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
872 "
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
873 " 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
874 " is in a single line.
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
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
877 XpathINIT
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
878
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
879 function! F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
880 Xpath 'a'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
881 let x = 0
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
882 if x " false
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
883 Xpath 'b'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
884 elseif !x " always true
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
885 Xpath 'c'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
886 let x = 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
887 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
888 Xpath 'f'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
889 elseif x " never executed
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
890 Xpath 'g'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
891 endif
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
892 Xpath 'h'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
893 endfunction
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
894
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
895 let boolvar = 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
896 call F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
897 Xpath '-'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
898
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
899 unlet boolvar
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
900 call F()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
901 let g:test15_result = g:Xpath
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
902
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
903 delfunction F
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
904
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
905 func Test_if_bar_fail()
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
906 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
907 endfunc
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
908
7627
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
909 "-------------------------------------------------------------------------------
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
910 " 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
911 "-------------------------------------------------------------------------------
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
912
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
913 func Test_curlies()
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
914 let s:var = 66
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
915 let ns = 's'
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
916 call assert_equal(66, {ns}:var)
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
917
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
918 let g:a = {}
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
919 let g:b = 't'
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
920 let g:a[g:b] = 77
d9ec7d22494d commit https://github.com/vim/vim/commit/4119cf80e1e534057680f9543e73edf7967c2440
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
921 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
922 endfunc
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
923
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7393
diff changeset
924 "-------------------------------------------------------------------------------
7718
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
925 " Test 91: using type(). {{{1
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
926 "-------------------------------------------------------------------------------
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
927
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
928 func Test_type()
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
929 call assert_equal(0, type(0))
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
930 call assert_equal(1, type(""))
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
931 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
932 call assert_equal(3, type([]))
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
933 call assert_equal(4, type({}))
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
934 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
935 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
936 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
937 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
938 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
939
80ce794827c4 commit https://github.com/vim/vim/commit/17a13437c9414a8693369a97f3be2fc8ad48c12e
Christian Brabandt <cb@256bit.org>
parents: 7718
diff changeset
940 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
941 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
942 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
943 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
944
7740
00fc76e6bd99 commit https://github.com/vim/vim/commit/f48aa160fdd7b8caa7678e1a2139244dd2bdc547
Christian Brabandt <cb@256bit.org>
parents: 7738
diff changeset
945 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
946 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
947 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
948 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
949
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
950 call assert_true(v:false == 0)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
951 call assert_false(v:false != 0)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
952 call assert_true(v:true == 1)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
953 call assert_false(v:true != 1)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
954 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
955 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
956
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
957 call assert_true(v:null == 0)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
958 call assert_false(v:null != 0)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
959 call assert_true(v:none == 0)
4a4f1dd1abe8 commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3
Christian Brabandt <cb@256bit.org>
parents: 7730
diff changeset
960 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
961
598a96d35a0e commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents: 7732
diff changeset
962 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
963 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
964 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
965 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
966
598a96d35a0e commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents: 7732
diff changeset
967 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
968 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
969 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
970 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
971
598a96d35a0e commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents: 7732
diff changeset
972 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
973 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
974 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
975 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
976 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
977 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
978
598a96d35a0e commit https://github.com/vim/vim/commit/04369229657f182d35b471eb8b38f273a4d9ef65
Christian Brabandt <cb@256bit.org>
parents: 7732
diff changeset
979 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
980 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
981 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
982 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
983 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
984 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
985
d6e62c739839 commit https://github.com/vim/vim/commit/65591001e405cbaaf9772c9375d0bb6049cf9a3a
Christian Brabandt <cb@256bit.org>
parents: 7740
diff changeset
986 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
987 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
988 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
989 call assert_equal(v:null, eval(string(v:null)))
7718
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
990 endfunc
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
991
6ebd8bdf41bc commit https://github.com/vim/vim/commit/f95534c3d411084d1b6112fe64f6108bf7acbb92
Christian Brabandt <cb@256bit.org>
parents: 7627
diff changeset
992 "-------------------------------------------------------------------------------
7393
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
993 " Modelines {{{1
467b7c511585 commit https://github.com/vim/vim/commit/f49e240c2def978247fa457aa105bb3024413f7d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
994 " 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
995 " 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
996 "-------------------------------------------------------------------------------