Mercurial > vim
annotate src/testdir/test_vimscript.vim @ 15713:ad8b2c109b22 v8.1.0864
patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
commit https://github.com/vim/vim/commit/375e3390078e740d3c83b0c118c50d9a920036c7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 31 18:26:10 2019 +0100
patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Problem: Cannot have a local value for 'scrolloff' and 'sidescrolloff'.
(Gary Holloway)
Solution: Make 'scrolloff' and 'sidescrolloff' global-local. (mostly by
Aron Widforss, closes #3539)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 31 Jan 2019 18:30:08 +0100 |
parents | 63b02fcf1361 |
children | 05d836c8f1c4 |
rev | line source |
---|---|
13351
33a2277b8d4d
patch 8.0.1549: various small problems in test files
Christian Brabandt <cb@256bit.org>
parents:
12523
diff
changeset
|
1 " Test various aspects of the Vim script language. |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Most of this was formerly in test49. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " Test environment {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
8 com! XpathINIT let g:Xpath = '' |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args> |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " Append a message to the "messages" file |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
12 func Xout(text) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 split messages |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 $put =a:text |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 wq |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 com! -nargs=1 Xout call Xout(<args>) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 " MakeScript() - Make a script file from a function. {{{2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 " Create a script that consists of the body of the function a:funcname. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 " Replace any ":return" by a ":finish", any argument variable by a global |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 " variable, and and every ":call" by a ":source" for the next following argument |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " in the variable argument list. This function is useful if similar tests are |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
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 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " file. |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
28 func MakeScript(funcname, ...) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let script = tempname() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 execute "redir! >" . script |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 execute "function" a:funcname |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 execute "edit" script |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 " Delete the "function" and the "endfunction" lines. Do not include the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 " word "function" in the pattern since it might be translated if LANG is |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " set. When MakeScript() is being debugged, this deletes also the debugging |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 " output of its line 3 and 4. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 exec '1,/.*' . a:funcname . '(.*)/d' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 /^\d*\s*endfunction\>/,$d |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 %s/^\d*//e |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 %s/return/finish/e |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 %s/\<a:\(\h\w*\)/g:\1/ge |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 normal gg0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 let cnt = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 while search('\<call\s*\%(\u\|s:\)\w*\s*(.*)', 'W') > 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let cnt = cnt + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 s/\<call\s*\%(\u\|s:\)\w*\s*(.*)/\='source ' . a:{cnt}/ |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 g/^\s*$/d |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 write |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 bwipeout |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 return script |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
53 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 " ExecAsScript - Source a temporary script made from a function. {{{2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 " Make a temporary script file from the function a:funcname, ":source" it, and |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 " delete it afterwards. However, if an exception is thrown the file may remain, |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 " the caller should call DeleteTheScript() afterwards. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 let s:script_name = '' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 function! ExecAsScript(funcname) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 " Make a script from the function passed as argument. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 let s:script_name = MakeScript(a:funcname) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 " Source and delete the script. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 exec "source" s:script_name |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call delete(s:script_name) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 let s:script_name = '' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 function! DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 if s:script_name |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 call delete(s:script_name) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 let s:script_name = '' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 " Test 1: :endwhile in function {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " Detect if a broken loop is (incorrectly) reactivated by the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 " :endwhile. Use a :return to prevent an endless loop, and make |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 " this test first to get a meaningful result on an error before other |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " tests will hang. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 function! T1_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 let first = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 if first |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 let first = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 function! T1_G() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 let first = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 if first |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 let first = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 if 1 " unmatched :if |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 func Test_endwhile_function() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 call T1_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 try |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 call T1_G() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 catch |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 " Catch missing :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 call assert_true(v:exception =~ 'E171') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 Xpath 'G' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 call assert_equal('abcFhijxG', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 " Test 2: :endwhile in script {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 " Detect if a broken loop is (incorrectly) reactivated by the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 " :endwhile. Use a :finish to prevent an endless loop, and place |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 " this test before others that might hang to get a meaningful result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 " on an error. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 " This test executes the bodies of the functions T1_F and T1_G from |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 " the previous test as script files (:return replaced by :finish). |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 func Test_endwhile_script() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 ExecAsScript T1_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 try |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 ExecAsScript T1_G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 catch |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 " Catch missing :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_true(v:exception =~ 'E171') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 Xpath 'G' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 call assert_equal('abcFhijxG', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 " Test 3: :if, :elseif, :while, :continue, :break {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 function Test_if_while() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 let loops = 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 while loops > -1 " main loop: loops == 3, 2, 1 (which breaks) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 if loops <= 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 let break_err = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 let loops = -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 Xpath 'b' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 if (loops == 2) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 while loops == 2 " dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 Xpath 'c' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 let loops = loops - 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 continue " stop dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 Xpath 'd' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 continue " continue main loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 Xpath 'e' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 elseif (loops == 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 let p = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 while p " dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 Xpath 'f' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 let p = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 break " break dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 Xpath 'g' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 Xpath 'h' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 unlet p |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 break " break main loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 Xpath 'i' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 if (loops > 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 Xpath 'j' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 while loops == 3 " dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 let loops = loops - 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 endwhile " end dummy loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 endwhile " end main loop |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 if exists("break_err") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 unlet break_err |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 unlet loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 " Test 4: :return {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 function! T4_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 let loops = 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 while loops > 0 " 3: 2: 1: |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 Xpath 'b' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 if (loops == 2) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 Xpath 'c' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 Xpath 'd' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 Xpath 'e' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 let loops = loops - 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 function Test_return() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 call T4_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 Xpath '4' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 call assert_equal('ab3e3b2c24', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 " Test 5: :finish {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
267 " This test executes the body of the function T4_F from the previous |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 " test as a script file (:return replaced by :finish). |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
269 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 function Test_finish() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 ExecAsScript T4_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 Xpath '5' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 call assert_equal('ab3e3b2c25', g:Xpath) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
279 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
280 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
283 " Test 6: Defining functions in :while loops {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 " Functions can be defined inside other functions. An inner function |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 " gets defined when the outer function is executed. Functions may |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
287 " also be defined inside while loops. Expressions in braces for |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 " defining the function name are allowed. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
290 " The functions are defined when sourcing the script, only the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
291 " resulting path is checked in the test function. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
294 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 " The command CALL collects the argument of all its invocations in "calls" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 " when used from a function (that is, when the global variable "calls" needs |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
298 " the "g:" prefix). This is to check that the function code is skipped when |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 " the function is defined. For inner functions, do so only if the outer |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 " function is not being executed. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
302 let calls = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
303 com! -nargs=1 CALL |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
304 \ if !exists("calls") && !exists("outer") | |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
305 \ let g:calls = g:calls . <args> | |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
306 \ endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
307 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
308 let i = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 while i < 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 let i = i + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 if i == 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 function! F1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 let outer = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 let j = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 while j < 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
319 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 let j = j + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 function! G1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
324 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 continue |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 Xpath 'e' . i |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 function! F{i}(i, arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 let outer = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 if a:i == 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 let k = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 while k < 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 Xpath 'g' . k |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 let k = k + 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 function! G{a:i}{k}(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 Xpath 'h' . k |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
350 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 if exists("*G1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 if exists("*F1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 call F1("F1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 if exists("*G1") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
360 call G1("G1") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 if exists("G21") || exists("G22") || exists("G23") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 if exists("*F2") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 call F2(2, "F2") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 if exists("*G21") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
370 call G21("G21") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
372 if exists("*G22") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
373 call G22("G22") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 if exists("*G23") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
376 call G23("G23") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
377 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
379 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 if exists("G31") || exists("G32") || exists("G33") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 if exists("*F3") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 call F3(3, "F3") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 if exists("*G31") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
386 call G31("G31") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 if exists("*G32") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
389 call G32("G32") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
390 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 if exists("*G33") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
392 call G33("G33") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
395 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 let g:test6_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 let g:test6_calls = calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 unlet calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 delfunction F1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 delfunction G1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 delfunction F2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 delfunction G21 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 delfunction G22 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 delfunction G23 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 delfunction G31 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 delfunction G32 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 delfunction G33 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 function Test_defining_functions() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 call assert_equal('ade2ie3ibcg0h1g1h2g2h3fg0h1g1h2g2h3m', g:test6_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 call assert_equal('F1G1F2G21G22G23F3G31G32G33', g:test6_calls) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
415 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
416 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
417 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
418 " Test 7: Continuing on errors outside functions {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
419 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
420 " On an error outside a function, the script processing continues |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
421 " at the line following the outermost :endif or :endwhile. When not |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 " inside an :if or :while, the script processing continues at the next |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
423 " line. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
424 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
425 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
426 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
427 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
428 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
429 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
430 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
431 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
433 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
434 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 endwhile | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
437 endif | Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
438 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
439 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
440 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
441 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
442 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
445 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 endif | Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 endwhile | Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
453 Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
454 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
455 asdf | Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
456 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
457 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
458 let g:test7_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 func Test_error_in_script() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
461 call assert_equal('abghinoq', g:test7_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
462 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
464 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
465 " Test 8: Aborting and continuing on errors inside functions {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
466 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
467 " On an error inside a function without the "abort" attribute, the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 " script processing continues at the next line (unless the error was |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
469 " in a :return command). On an error inside a function with the |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
470 " "abort" attribute, the function is aborted and the script processing |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 " continues after the function call; the value -1 is returned then. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
472 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
473 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
474 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
475 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 function! T8_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
477 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
478 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
479 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
481 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
483 asdf | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
484 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
485 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
486 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 endif | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
489 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
490 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
491 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
492 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
493 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
494 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
495 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
496 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
497 asdf | Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
498 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
500 Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
501 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
502 endwhile | Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
503 Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
504 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
505 return novar " returns (default return value 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
506 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
507 return 1 " not reached |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
508 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
509 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
510 function! T8_G() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
511 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 Xpath 'r' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
513 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
514 Xpath 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
515 asdf " returns -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
516 Xpath 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
517 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
518 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
519 Xpath 'v' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
520 endif | Xpath 'w' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
521 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
522 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
523 return -4 " not reached |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
524 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
525 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
526 function! T8_H() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
527 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
528 Xpath 'A' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
529 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
530 Xpath 'B' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
531 asdf " returns -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
532 Xpath 'C' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
533 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
534 Xpath 'D' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
535 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 endwhile | Xpath 'E' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
537 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
538 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
539 return -4 " not reached |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
540 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
541 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
542 " Aborted functions (T8_G and T8_H) return -1. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
543 let g:test8_sum = (T8_F() + 1) - 4 * T8_G() - 8 * T8_H() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 Xpath 'X' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
545 let g:test8_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
546 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
547 func Test_error_in_function() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
548 call assert_equal(13, g:test8_sum) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
549 call assert_equal('abcefghijkmnoprsABX', g:test8_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
550 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
551 delfunction T8_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
552 delfunction T8_G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
553 delfunction T8_H |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
556 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
557 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 " Test 9: Continuing after aborted functions {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
559 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
560 " When a function with the "abort" attribute is aborted due to an |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 " error, the next function back in the call hierarchy without an |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
562 " "abort" attribute continues; the value -1 is returned then. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
563 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
564 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
565 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
566 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 function! F() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 let result = G() " not aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 if result != 2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
572 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
573 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
574 return 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
575 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 function! G() " no abort attribute |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 if H() != -1 " aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
580 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
581 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
583 return 2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
584 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
586 function! H() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 call I() " aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
589 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
590 return 4 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
591 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
592 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
593 function! I() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
594 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
595 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 return 8 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 if F() != 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 let g:test9_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
605 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 delfunction G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
608 delfunction H |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
609 delfunction I |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
610 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
611 func Test_func_abort() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 call assert_equal('adgifb', g:test9_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
613 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
614 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
615 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
616 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
617 " Test 10: :if, :elseif, :while argument parsing {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
618 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
619 " A '"' or '|' in an argument expression must not be mixed up with |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
620 " a comment or a next command after a bar. Parsing errors should |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
621 " be recognized. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
622 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
623 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
624 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
625 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
626 function! MSG(enr, emsg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
627 let english = v:lang == "C" || v:lang =~ '^[Ee]n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 if a:enr == "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
629 Xout "TODO: Add message number for:" a:emsg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
630 let v:errmsg = ":" . v:errmsg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
631 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 let match = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
634 let match = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 if v:errmsg == "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 Xout "Message missing." |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
637 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 let v:errmsg = escape(v:errmsg, '"') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
639 Xout "Unexpected message:" v:errmsg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
640 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
641 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
642 return match |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
643 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
644 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
645 if 1 || strlen("\"") | Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
646 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
647 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
648 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
649 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 elseif 1 || strlen("\"") | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
652 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
655 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 while 1 || strlen("\"") | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
657 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
660 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
661 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
662 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 if 1 ||| strlen("\"") | Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
667 if !MSG('E15', "Invalid expression") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
668 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
669 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
670 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
671 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
673 elseif 1 ||| strlen("\"") | Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
674 Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
675 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
676 Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
677 if !MSG('E15', "Invalid expression") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
681 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
682 while 1 ||| strlen("\"") | Xpath 'r' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 Xpath 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
684 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 Xpath 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 if !MSG('E15', "Invalid expression") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
688 Xpath 'u' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
691 let g:test10_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 delfunction MSG |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
693 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
694 func Test_expr_parsing() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
695 call assert_equal('abcdefghilpt', g:test10_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
696 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
698 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
699 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 " Test 11: :if, :elseif, :while argument evaluation after abort {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
701 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
702 " When code is skipped over due to an error, the boolean argument to |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 " an :if, :elseif, or :while must not be evaluated. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
706 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 let calls = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
709 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
710 function! P(num) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 let g:calls = g:calls + a:num " side effect on call |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
713 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
714 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
715 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
716 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
718 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
719 if P(1) " should not be called |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
721 elseif !P(2) " should not be called |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
722 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
723 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
724 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
725 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
726 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
727 while P(4) " should not be called |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
728 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
729 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
731 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
732 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
733 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
734 let g:test11_calls = calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 let g:test11_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
736 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
737 unlet calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 delfunction P |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
739 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
740 func Test_arg_abort() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
741 call assert_equal(0, g:test11_calls) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 call assert_equal('ax', g:test11_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
744 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
745 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
746 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
747 " Test 12: Expressions in braces in skipped code {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
748 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
749 " In code skipped over due to an error or inactive conditional, |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 " an expression in braces as part of a variable or function name |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
751 " should not be evaluated. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
752 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
753 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
754 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
755 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 function! NULL() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
757 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
758 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
761 function! ZERO() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
765 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 function! F0() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
768 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 function! F1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
772 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
773 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
774 let V0 = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 echo 0 ? F{NULL() + V{ZERO()}}() : 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
779 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
780 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
781 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 call F{NULL() + V{ZERO()}}() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
784 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
785 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
786 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
789 call F1(F{NULL() + V{ZERO()}}()) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
791 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
793 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
796 call F{NULL() + V{ZERO()}}() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
797 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 let g:test12_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
801 func Test_braces_skipped() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
802 call assert_equal('fgik', g:test12_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
803 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
804 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
805 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
806 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
807 " Test 13: Failure in argument evaluation for :while {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
808 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
809 " A failure in the expression evaluation for the condition of a :while |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 " causes the whole :while loop until the matching :endwhile being |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
811 " ignored. Continuation is at the next following line. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
812 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
813 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
814 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
815 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
816 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
817 while asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
824 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
825 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
826 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 while asdf | Xpath 'f' | endwhile | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
829 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
830 let g:test13_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
832 func Test_while_fail() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 call assert_equal('aeh', g:test13_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
837 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 " Test 14: Failure in argument evaluation for :if {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
839 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
840 " A failure in the expression evaluation for the condition of an :if |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
841 " does not cause the corresponding :else or :endif being matched to |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
842 " a previous :if/:elseif. Neither of both branches of the failed :if |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 " are executed. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
846 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
848 function! F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 let x = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 if x " false |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
852 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 elseif !x " always true |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
854 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
855 let x = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 if g:boolvar " possibly undefined |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
857 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
860 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
862 elseif x " never executed |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
863 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
864 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 let boolvar = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
870 Xpath '-' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 unlet boolvar |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
874 let g:test14_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
875 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
878 func Test_if_fail() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 call assert_equal('acdfh-acfh', g:test14_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
880 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
883 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 " Test 15: Failure in argument evaluation for :if (bar) {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
886 " Like previous test, except that the failing :if ... | ... | :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 " is in a single line. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
888 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
889 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
890 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
891 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 function! F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
893 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
894 let x = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 if x " false |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
897 elseif !x " always true |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 let x = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 if g:boolvar | Xpath 'd' | else | Xpath 'e' | endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
901 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
902 elseif x " never executed |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
904 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
906 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 let boolvar = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 Xpath '-' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
911 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 unlet boolvar |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 let g:test15_result = g:Xpath |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
918 func Test_if_bar_fail() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 call assert_equal('acdfh-acfh', g:test15_result) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
920 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
921 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
922 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
923 " Test 90: Recognizing {} in variable name. {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
924 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
925 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
926 func Test_curlies() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
927 let s:var = 66 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
928 let ns = 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
929 call assert_equal(66, {ns}:var) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
930 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
931 let g:a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
932 let g:b = 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
933 let g:a[g:b] = 77 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
934 call assert_equal(77, g:a['t']) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
935 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
936 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
937 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
938 " Test 91: using type(). {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
939 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
940 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
941 func Test_type() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
942 call assert_equal(0, type(0)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
943 call assert_equal(1, type("")) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
944 call assert_equal(2, type(function("tr"))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
945 call assert_equal(2, type(function("tr", [8]))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
946 call assert_equal(3, type([])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
947 call assert_equal(4, type({})) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 call assert_equal(5, type(0.0)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
949 call assert_equal(6, type(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 call assert_equal(6, type(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
951 call assert_equal(7, type(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
952 call assert_equal(7, type(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
953 call assert_equal(8, v:t_job) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
954 call assert_equal(9, v:t_channel) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
955 call assert_equal(v:t_number, type(0)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
956 call assert_equal(v:t_string, type("")) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
957 call assert_equal(v:t_func, type(function("tr"))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
958 call assert_equal(v:t_func, type(function("tr", [8]))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
959 call assert_equal(v:t_list, type([])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
960 call assert_equal(v:t_dict, type({})) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
961 call assert_equal(v:t_float, type(0.0)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
962 call assert_equal(v:t_bool, type(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
963 call assert_equal(v:t_bool, type(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
964 call assert_equal(v:t_none, type(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
965 call assert_equal(v:t_none, type(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
966 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
967 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
968 call assert_equal(0, 0 + v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
969 call assert_equal(1, 0 + v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
970 call assert_equal(0, 0 + v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
971 call assert_equal(0, 0 + v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
972 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
973 call assert_equal('v:false', '' . v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
974 call assert_equal('v:true', '' . v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
975 call assert_equal('v:none', '' . v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
976 call assert_equal('v:null', '' . v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
977 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
978 call assert_true(v:false == 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
979 call assert_false(v:false != 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
980 call assert_true(v:true == 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
981 call assert_false(v:true != 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
982 call assert_false(v:true == v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
983 call assert_true(v:true != v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
984 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
985 call assert_true(v:null == 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
986 call assert_false(v:null != 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
987 call assert_true(v:none == 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
988 call assert_false(v:none != 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
989 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
990 call assert_true(v:false is v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
991 call assert_true(v:true is v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
992 call assert_true(v:none is v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
993 call assert_true(v:null is v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
994 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
995 call assert_false(v:false isnot v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
996 call assert_false(v:true isnot v:true) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
997 call assert_false(v:none isnot v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
998 call assert_false(v:null isnot v:null) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
999 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1000 call assert_false(v:false is 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1001 call assert_false(v:true is 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1002 call assert_false(v:true is v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1003 call assert_false(v:none is 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1004 call assert_false(v:null is 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1005 call assert_false(v:null is v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1006 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1007 call assert_true(v:false isnot 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1008 call assert_true(v:true isnot 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1009 call assert_true(v:true isnot v:false) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1010 call assert_true(v:none isnot 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1011 call assert_true(v:null isnot 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1012 call assert_true(v:null isnot v:none) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1013 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1014 call assert_equal(v:false, eval(string(v:false))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1015 call assert_equal(v:true, eval(string(v:true))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1016 call assert_equal(v:none, eval(string(v:none))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1017 call assert_equal(v:null, eval(string(v:null))) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1018 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1019 call assert_equal(v:false, copy(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1020 call assert_equal(v:true, copy(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1021 call assert_equal(v:none, copy(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1022 call assert_equal(v:null, copy(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 call assert_equal([v:false], deepcopy([v:false])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1025 call assert_equal([v:true], deepcopy([v:true])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1026 call assert_equal([v:none], deepcopy([v:none])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1027 call assert_equal([v:null], deepcopy([v:null])) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1028 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1029 call assert_true(empty(v:false)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1030 call assert_false(empty(v:true)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1031 call assert_true(empty(v:null)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1032 call assert_true(empty(v:none)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1033 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1034 func ChangeYourMind() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1035 try |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1036 return v:true |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1037 finally |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1038 return 'something else' |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1039 endtry |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1040 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1041 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1042 call ChangeYourMind() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1043 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1044 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1045 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1046 " Test 92: skipping code {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1047 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1048 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1049 func Test_skip() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1050 let Fn = function('Test_type') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1051 call assert_false(0 && Fn[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1052 call assert_false(0 && string(Fn)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1053 call assert_false(0 && len(Fn)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1054 let l = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1055 call assert_false(0 && l[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1056 call assert_false(0 && string(l)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1057 call assert_false(0 && len(l)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1058 let f = 1.0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1059 call assert_false(0 && f[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1060 call assert_false(0 && string(f)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1061 call assert_false(0 && len(f)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1062 let sp = v:null |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1063 call assert_false(0 && sp[1]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1064 call assert_false(0 && string(sp)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1065 call assert_false(0 && len(sp)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1066 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1067 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1068 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1069 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1070 " Test 93: :echo and string() {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1071 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1072 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1073 func Test_echo_and_string() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1074 " String |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1075 let a = 'foo bar' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1076 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1077 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1078 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1079 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1080 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1081 call assert_equal(["foo bar", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1082 \ "'foo bar'"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1083 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1084 " Float |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1085 if has('float') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1086 let a = -1.2e0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1087 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1088 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1089 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1090 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1091 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1092 call assert_equal(["-1.2", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1093 \ "-1.2"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1094 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1095 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1096 " Funcref |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1097 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1098 echo function('string') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1099 echo string(function('string')) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1100 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1101 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1102 call assert_equal(["string", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1103 \ "function('string')"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1104 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1105 " Recursive dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1106 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1107 let a["a"] = a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1108 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1109 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1110 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1111 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1112 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1113 call assert_equal(["{'a': {...}}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1114 \ "{'a': {...}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1115 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1116 " Recursive list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1117 let a = [0] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1118 let a[0] = a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1119 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1122 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 call assert_equal(["[[...]]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1125 \ "[[...]]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1127 " Empty dictionaries in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1129 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1130 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1131 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1132 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1133 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1134 call assert_equal(["[{}, {}, {}]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1135 \ "[{}, {}, {}]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1136 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1137 " Empty dictionaries in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1138 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1139 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1140 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1141 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1142 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1143 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1144 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1145 call assert_equal(["{'a': {}, 'b': {}}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1146 \ "{'a': {}, 'b': {}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1147 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1148 " Empty lists in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1149 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1150 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1151 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1152 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1153 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1154 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1155 call assert_equal(["[[], [], []]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1156 \ "[[], [], []]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1157 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1158 " Empty lists in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1159 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1160 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1161 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1162 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1163 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1164 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1165 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1166 call assert_equal(["{'a': [], 'b': []}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1167 \ "{'a': [], 'b': []}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1168 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1169 " Dictionaries in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1170 let a = {"one": "yes", "two": "yes", "three": "yes"} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1171 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1172 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1173 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1174 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1175 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1176 call assert_equal(["[{'one': 'yes', 'two': 'yes', 'three': 'yes'}, {...}, {...}]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1177 \ "[{'one': 'yes', 'two': 'yes', 'three': 'yes'}, {'one': 'yes', 'two': 'yes', 'three': 'yes'}, {'one': 'yes', 'two': 'yes', 'three': 'yes'}]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1178 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1179 " Dictionaries in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1180 let a = {"one": "yes", "two": "yes", "three": "yes"} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1181 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1182 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1183 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1184 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1185 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1186 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1187 call assert_equal(["{'a': {'one': 'yes', 'two': 'yes', 'three': 'yes'}, 'b': {...}}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1188 \ "{'a': {'one': 'yes', 'two': 'yes', 'three': 'yes'}, 'b': {'one': 'yes', 'two': 'yes', 'three': 'yes'}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1189 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1190 " Lists in a list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1191 let a = [1, 2, 3] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1192 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1193 echo [a, a, a] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1194 echo string([a, a, a]) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1195 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1196 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1197 call assert_equal(["[[1, 2, 3], [...], [...]]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1198 \ "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1199 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1200 " Lists in a dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1201 let a = [1, 2, 3] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1202 let b = {"a": a, "b": a} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1203 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1204 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1205 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1206 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1207 let l = split(result, "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1208 call assert_equal(["{'a': [1, 2, 3], 'b': [...]}", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1209 \ "{'a': [1, 2, 3], 'b': [1, 2, 3]}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1210 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1211 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1212 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1213 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1214 " Test 94: 64-bit Numbers {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1215 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1216 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1217 func Test_num64() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1218 if !has('num64') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1219 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1220 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1221 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1222 call assert_notequal( 4294967296, 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1223 call assert_notequal(-4294967296, 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1224 call assert_equal( 4294967296, 0xFFFFffff + 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1225 call assert_equal(-4294967296, -0xFFFFffff - 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1226 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1227 call assert_equal( 9223372036854775807, 1 / 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1228 call assert_equal(-9223372036854775807, -1 / 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1229 call assert_equal(-9223372036854775807 - 1, 0 / 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1230 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1231 call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1232 call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1233 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1234 let rng = range(0xFFFFffff, 0x100000001) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1235 call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1236 call assert_equal(0x100000001, max(rng)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1237 call assert_equal(0xFFFFffff, min(rng)) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1238 call assert_equal(rng, sort(range(0x100000001, 0xFFFFffff, -1), 'N')) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1239 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1240 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1241 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1242 " Test 95: lines of :append, :change, :insert {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1243 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1244 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1245 function! DefineFunction(name, body) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1246 let func = join(['function! ' . a:name . '()'] + a:body + ['endfunction'], "\n") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1247 exec func |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1248 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1249 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1250 func Test_script_lines() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1251 " :append |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1252 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1253 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1254 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1255 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1256 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1257 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1258 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1259 call assert_report("Can't define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1260 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1261 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1262 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1263 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1264 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1265 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1266 call assert_report("Shouldn't be able to define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1267 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1268 call assert_exception('Vim(function):E126: Missing :endfunction') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1269 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1270 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1271 " :change |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1272 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1273 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1274 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1275 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1276 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1277 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1278 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1279 call assert_report("Can't define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1280 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1281 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1282 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1283 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1284 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1285 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1286 call assert_report("Shouldn't be able to define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1287 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1288 call assert_exception('Vim(function):E126: Missing :endfunction') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1289 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1290 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1291 " :insert |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1292 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1293 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1294 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1295 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1296 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1297 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1298 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1299 call assert_report("Can't define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1300 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1301 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1302 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1303 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1304 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1305 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1306 call assert_report("Shouldn't be able to define function") |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1307 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1308 call assert_exception('Vim(function):E126: Missing :endfunction') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1309 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1310 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1311 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1312 "------------------------------------------------------------------------------- |
11352
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1313 " Test 96: line continuation {{{1 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1314 " |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1315 " Undefined behavior was detected by ubsan with line continuation |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1316 " after an empty line. |
11352
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1317 "------------------------------------------------------------------------------- |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1318 func Test_script_emty_line_continuation() |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1319 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1320 \ |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1321 endfunc |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1322 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1323 "------------------------------------------------------------------------------- |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1324 " Test 97: bitwise functions {{{1 |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1325 "------------------------------------------------------------------------------- |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1326 func Test_bitwise_functions() |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1327 " and |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1328 call assert_equal(127, and(127, 127)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1329 call assert_equal(16, and(127, 16)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1330 call assert_equal(0, and(127, 128)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1331 call assert_fails("call and(1.0, 1)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1332 call assert_fails("call and([], 1)", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1333 call assert_fails("call and({}, 1)", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1334 call assert_fails("call and(1, 1.0)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1335 call assert_fails("call and(1, [])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1336 call assert_fails("call and(1, {})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1337 " or |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1338 call assert_equal(23, or(16, 7)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1339 call assert_equal(15, or(8, 7)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1340 call assert_equal(123, or(0, 123)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1341 call assert_fails("call or(1.0, 1)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1342 call assert_fails("call or([], 1)", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1343 call assert_fails("call or({}, 1)", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1344 call assert_fails("call or(1, 1.0)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1345 call assert_fails("call or(1, [])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1346 call assert_fails("call or(1, {})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1347 " xor |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1348 call assert_equal(0, xor(127, 127)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1349 call assert_equal(111, xor(127, 16)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1350 call assert_equal(255, xor(127, 128)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1351 call assert_fails("call xor(1.0, 1)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1352 call assert_fails("call xor([], 1)", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1353 call assert_fails("call xor({}, 1)", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1354 call assert_fails("call xor(1, 1.0)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1355 call assert_fails("call xor(1, [])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1356 call assert_fails("call xor(1, {})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1357 " invert |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1358 call assert_equal(65408, and(invert(127), 65535)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1359 call assert_equal(65519, and(invert(16), 65535)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1360 call assert_equal(65407, and(invert(128), 65535)) |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1361 call assert_fails("call invert(1.0)", 'E805:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1362 call assert_fails("call invert([])", 'E745:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1363 call assert_fails("call invert({})", 'E728:') |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1364 endfunc |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1365 |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1366 " Test trailing text after :endfunction {{{1 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1367 func Test_endfunction_trailing() |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1368 call assert_false(exists('*Xtest')) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1369 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1370 exe "func Xtest()\necho 'hello'\nendfunc\nlet done = 'yes'" |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1371 call assert_true(exists('*Xtest')) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1372 call assert_equal('yes', done) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1373 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1374 unlet done |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1375 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1376 exe "func Xtest()\necho 'hello'\nendfunc|let done = 'yes'" |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1377 call assert_true(exists('*Xtest')) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1378 call assert_equal('yes', done) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1379 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1380 unlet done |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1381 |
11569
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1382 " trailing line break |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1383 exe "func Xtest()\necho 'hello'\nendfunc\n" |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1384 call assert_true(exists('*Xtest')) |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1385 delfunc Xtest |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1386 |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1387 set verbose=1 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1388 exe "func Xtest()\necho 'hello'\nendfunc \" garbage" |
11561
7ad79766365a
patch 8.0.0663: unexpected error message only when 'verbose' is set
Christian Brabandt <cb@256bit.org>
parents:
11547
diff
changeset
|
1389 call assert_notmatch('W22:', split(execute('1messages'), "\n")[0]) |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1390 call assert_true(exists('*Xtest')) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1391 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1392 |
11561
7ad79766365a
patch 8.0.0663: unexpected error message only when 'verbose' is set
Christian Brabandt <cb@256bit.org>
parents:
11547
diff
changeset
|
1393 exe "func Xtest()\necho 'hello'\nendfunc garbage" |
7ad79766365a
patch 8.0.0663: unexpected error message only when 'verbose' is set
Christian Brabandt <cb@256bit.org>
parents:
11547
diff
changeset
|
1394 call assert_match('W22:', split(execute('1messages'), "\n")[0]) |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1395 call assert_true(exists('*Xtest')) |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1396 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1397 set verbose=0 |
11569
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1398 |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1399 function Foo() |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1400 echo 'hello' |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1401 endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1402 delfunc Foo |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1403 endfunc |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1404 |
11545
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1405 func Test_delfunction_force() |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1406 delfunc! Xtest |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1407 delfunc! Xtest |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1408 func Xtest() |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1409 echo 'nothing' |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1410 endfunc |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1411 delfunc! Xtest |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1412 delfunc! Xtest |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1413 endfunc |
1780e6fecb30
patch 8.0.0655: not easy to make sure a function does not exist
Christian Brabandt <cb@256bit.org>
parents:
11543
diff
changeset
|
1414 |
11547
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1415 " Test using bang after user command {{{1 |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1416 func Test_user_command_with_bang() |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1417 command -bang Nieuw let nieuw = 1 |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1418 Ni! |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1419 call assert_equal(1, nieuw) |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1420 unlet nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1421 delcommand Nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1422 endfunc |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1423 |
12523
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1424 " Test for script-local function |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1425 func <SID>DoLast() |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1426 call append(line('$'), "last line") |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1427 endfunc |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1428 |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1429 func s:DoNothing() |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1430 call append(line('$'), "nothing line") |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1431 endfunc |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1432 |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1433 func Test_script_local_func() |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1434 set nocp viminfo+=nviminfo |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1435 new |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1436 nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr> |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1437 |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1438 normal _x |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1439 call assert_equal('nothing line', getline(2)) |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1440 call assert_equal('last line', getline(3)) |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1441 enew! | close |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1442 endfunc |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1443 |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1444 "------------------------------------------------------------------------------- |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1445 " Modelines {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1446 " vim: ts=8 sw=4 tw=80 fdm=marker |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1447 " vim: fdt=substitute(substitute(foldtext(),\ '\\%(^+--\\)\\@<=\\(\\s*\\)\\(.\\{-}\\)\:\ \\%(\"\ \\)\\=\\(Test\ \\d*\\)\:\\s*',\ '\\3\ (\\2)\:\ \\1',\ \"\"),\ '\\(Test\\s*\\)\\(\\d\\)\\D\\@=',\ '\\1\ \\2',\ "") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1448 "------------------------------------------------------------------------------- |