Mercurial > vim
annotate src/testdir/test_vimscript.vim @ 19852:12518b40c161 v8.2.0482
patch 8.2.0482: channel and sandbox code not sufficiently tested
Commit: https://github.com/vim/vim/commit/ca68ae13114619df3e4c195b41ad0575516f5ff6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 30 19:32:53 2020 +0200
patch 8.2.0482: channel and sandbox code not sufficiently tested
Problem: Channel and sandbox code not sufficiently tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5855)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 30 Mar 2020 19:45:05 +0200 |
parents | b3e93a05c3ca |
children | 2c4d9ca33769 |
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 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17251
diff
changeset
|
4 source check.vim |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
5 source shared.vim |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17251
diff
changeset
|
6 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " Test environment {{{1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
11 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
|
12 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
|
13 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 " 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
|
15 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
|
16 split messages |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 $put =a:text |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 wq |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 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
|
22 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 " 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
|
24 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " 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
|
26 " Replace any ":return" by a ":finish", any argument variable by a global |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
27 " variable, and every ":call" by a ":source" for the next following argument |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 " 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
|
29 " 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
|
30 " file. |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
31 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
|
32 let script = tempname() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 execute "redir! >" . script |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 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
|
35 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 execute "edit" script |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 " 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
|
38 " 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
|
39 " 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
|
40 " 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
|
41 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
|
42 /^\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
|
43 %s/^\d*//e |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 %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
|
45 %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
|
46 normal gg0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 let cnt = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 g/^\s*$/d |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 write |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 bwipeout |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 return script |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
56 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 " 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
|
59 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 " 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
|
61 " 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
|
62 " 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
|
63 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
|
64 function! ExecAsScript(funcname) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 " 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
|
66 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
|
67 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 " 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
|
69 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
|
70 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
|
71 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
|
72 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 function! DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 endfunc |
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 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
|
82 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 " 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
|
86 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " 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
|
88 " :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
|
89 " 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
|
90 " tests will hang. |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 function! T1_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 let first = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 if first |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 let first = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 function! T1_G() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 let first = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 if first |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 let first = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 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
|
123 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 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
|
127 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 call T1_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 try |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 call T1_G() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 catch |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 " Catch missing :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 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
|
136 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 Xpath 'G' |
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 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
|
141 endfunc |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 " 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
|
145 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 " 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
|
147 " :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
|
148 " 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
|
149 " on an error. |
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 " 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
|
152 " 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
|
153 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 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
|
156 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 ExecAsScript T1_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 Xpath 'F' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 call DeleteTheScript() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 try |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 ExecAsScript T1_G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 catch |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 " Catch missing :endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 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
|
166 Xpath 'x' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 Xpath 'G' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 call DeleteTheScript() |
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 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
|
172 endfunc |
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 " 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
|
176 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 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
|
179 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 let loops = 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 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
|
184 if loops <= 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 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
|
186 let loops = -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 Xpath 'b' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 if (loops == 2) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 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
|
192 Xpath 'c' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 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
|
194 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
|
195 Xpath 'd' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 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
|
198 Xpath 'e' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 elseif (loops == 1) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 let p = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 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
|
202 Xpath 'f' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 let p = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 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
|
205 Xpath 'g' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 Xpath 'h' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 unlet p |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 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
|
210 Xpath 'i' . 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 if (loops > 0) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 Xpath 'j' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 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
|
219 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 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
|
225 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 unlet break_err |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 unlet loops |
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 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
|
232 endfunc |
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 " 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
|
236 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 function! T4_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 let loops = 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 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
|
243 Xpath 'b' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 if (loops == 2) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 Xpath 'c' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 return |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 Xpath 'd' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 Xpath 'e' . loops |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 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
|
251 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 function Test_return() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 call T4_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 Xpath '4' |
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 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
|
264 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 " 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
|
269 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 " 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
|
271 " 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
|
272 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 function Test_finish() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 ExecAsScript T4_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 Xpath '5' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 call DeleteTheScript() |
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 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
|
281 endfunction |
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 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 " 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
|
287 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 " 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
|
289 " 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
|
290 " 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
|
291 " 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
|
292 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 " 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
|
294 " 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
|
295 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
298 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 " 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
|
300 " 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
|
301 " 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
|
302 " 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
|
303 " 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
|
304 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
305 let calls = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
306 com! -nargs=1 CALL |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
307 \ if !exists("calls") && !exists("outer") | |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
308 \ 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
|
309 \ endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
310 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 let i = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 while i < 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 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
|
314 if i == 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 function! F1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 let outer = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
319 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 let j = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 while j < 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 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
|
324 function! G1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 CALL a:arg |
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 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 Xpath 'd' |
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 continue |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 Xpath 'e' . i |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 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
|
337 CALL a:arg |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 let outer = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 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
|
341 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 let k = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 while k < 3 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 Xpath 'g' . k |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 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
|
347 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
|
348 CALL a:arg |
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 'h' . k |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 if exists("*G1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 if exists("*F1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 call F1("F1") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 if exists("*G1") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
363 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
|
364 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 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
|
368 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
370 if exists("*F2") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 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
|
372 if exists("*G21") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
373 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
|
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("*G22") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
376 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
|
377 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 if exists("*G23") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
379 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
|
380 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 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
|
384 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 if exists("*F3") |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 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
|
388 if exists("*G31") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
389 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
|
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("*G32") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
392 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
|
393 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 if exists("*G33") |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
395 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
|
396 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 Xpath 'm' |
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 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
|
402 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
|
403 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 unlet calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 delfunction F1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 delfunction G1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 delfunction F2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 delfunction G21 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 delfunction G22 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 delfunction G23 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 delfunction G31 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 delfunction G32 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 delfunction G33 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 endfunc |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
421 " 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
|
422 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
423 " 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
|
424 " 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
|
425 " 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
|
426 " line. |
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 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
429 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
430 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
431 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
433 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
434 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
437 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
438 endwhile | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
439 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
440 endif | Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
441 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
442 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
445 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 endif | Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 endwhile | Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
453 Xpath 'n' |
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 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
456 Xpath 'o' |
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 asdf | Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
461 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
|
462 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 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
|
464 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
|
465 endfunc |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 " 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
|
469 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
470 " 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
|
471 " 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
|
472 " 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
|
473 " "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
|
474 " 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
|
475 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
477 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
478 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
479 function! T8_F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
481 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
483 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
484 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
485 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
486 asdf | Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
489 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
490 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
491 endif | Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
492 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
493 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
494 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
495 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
496 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
497 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
498 asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
500 asdf | Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
501 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
502 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
503 Xpath 'n' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
504 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
505 endwhile | Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
506 Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
507 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
508 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
|
509 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
510 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
|
511 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
513 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
|
514 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
515 Xpath 'r' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
516 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
517 Xpath 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
518 asdf " returns -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
519 Xpath 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
520 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
521 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
522 Xpath 'v' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
523 endif | Xpath 'w' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
524 Xpath 'x' |
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 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
|
527 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
528 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
529 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
|
530 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
531 Xpath 'A' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
532 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
533 Xpath 'B' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
534 asdf " returns -1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
535 Xpath 'C' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
537 Xpath 'D' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
538 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
539 endwhile | Xpath 'E' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
540 Xpath 'F' |
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 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
|
543 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
545 " 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
|
546 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
|
547 Xpath 'X' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
548 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
|
549 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 delfunction T8_F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 delfunction T8_G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
556 delfunction T8_H |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
557 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 " 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
|
562 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
563 " 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
|
564 " 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
|
565 " "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
|
566 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 function! F() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
572 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
|
573 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
574 if result != 2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
575 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 return 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
580 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
|
581 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 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
|
583 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
584 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
586 return 2 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
589 function! H() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
590 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
591 call I() " aborted |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
592 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
593 return 4 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
594 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
595 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 function! I() abort |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 return 8 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 if F() != 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
605 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 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
|
608 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
609 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
610 delfunction G |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
611 delfunction H |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 delfunction I |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
613 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
614 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
|
615 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
|
616 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
617 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
620 " 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
|
621 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
622 " 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
|
623 " 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
|
624 " be recognized. |
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 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
627 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
629 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
|
630 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
|
631 if a:enr == "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 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
|
633 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
|
634 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 let match = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 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
|
637 let match = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 if 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 "Message missing." |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
640 else |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17783
diff
changeset
|
641 let v:errmsg = v:errmsg->escape('"') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
642 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
|
643 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
644 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
645 return match |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
646 endfunc |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
647 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
648 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
|
649 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
652 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 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
|
655 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
657 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 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
|
660 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
661 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
662 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 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
|
667 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
668 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
669 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
670 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
|
671 Xpath 'm' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
673 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
674 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
675 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
676 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
|
677 Xpath 'o' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 Xpath 'p' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 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
|
681 Xpath 'q' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
682 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
684 let v:errmsg = "" |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 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
|
686 Xpath 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
688 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 Xpath 't' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 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
|
691 Xpath 'u' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 endif |
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 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
|
695 delfunction MSG |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
696 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 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
|
698 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
|
699 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 " 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
|
704 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 " 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
|
706 " 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
|
707 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
709 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
710 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 let calls = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
713 function! P(num) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
714 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
|
715 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
716 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
718 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
719 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
721 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
722 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
|
723 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
724 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
|
725 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
726 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
727 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
728 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
729 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 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
|
731 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
732 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
733 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
734 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 Xpath 'x' |
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 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
|
738 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
|
739 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
740 unlet calls |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
741 delfunction P |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 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
|
744 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
|
745 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
|
746 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
747 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 " 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
|
751 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
752 " 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
|
753 " 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
|
754 " 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
|
755 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
757 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
758 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 function! NULL() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
761 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 function! ZERO() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
765 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 return 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
768 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 function! F0() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
772 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
773 function! F1(arg) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
774 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 let V0 = 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 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
780 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
|
781 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 if 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
784 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
785 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
|
786 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 Xpath 'i' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
789 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
791 Xpath 'j' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 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
|
793 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 Xpath 'k' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
796 if 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
797 asdf " error |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 Xpath 'l' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 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
|
800 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
801 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
802 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
|
803 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
804 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
|
805 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
|
806 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
807 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 " 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
|
811 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
812 " 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
|
813 " 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
|
814 " 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
|
815 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
816 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
817 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 while asdf |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 while 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 Xpath 'c' |
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 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 break |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 endwhile |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
829 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
830 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 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
|
832 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 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
|
834 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 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
|
836 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
|
837 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
841 " 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
|
842 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 " 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
|
844 " 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
|
845 " 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
|
846 " are executed. |
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 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 function! F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
852 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 let x = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
854 if x " false |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
855 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 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
|
857 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 let x = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 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
|
860 Xpath 'd' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 else |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
862 Xpath 'e' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
863 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
864 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 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
|
866 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
870 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 let boolvar = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 Xpath '-' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
874 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
875 unlet boolvar |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 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
|
878 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
880 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 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
|
882 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
|
883 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 |
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 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 " 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
|
888 " |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
889 " 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
|
890 " 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
|
891 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
893 XpathINIT |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
894 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 function! F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 Xpath 'a' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
897 let x = 0 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 if x " false |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 Xpath 'b' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 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
|
901 Xpath 'c' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
902 let x = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 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
|
904 Xpath 'f' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 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
|
906 Xpath 'g' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 Xpath 'h' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
911 let boolvar = 1 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 Xpath '-' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 unlet boolvar |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 call F() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 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
|
918 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 delfunction F |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
920 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
921 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
|
922 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
|
923 endfunc |
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 "------------------------------------------------------------------------------- |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
926 " Test 16: Double :else or :elseif after :else {{{1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
927 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
928 " Multiple :elses or an :elseif after an :else are forbidden. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
929 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
930 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
931 func T16_F() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
932 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
933 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
934 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
935 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
936 else " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
937 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
938 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
939 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
940 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
941 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
942 func T16_G() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
943 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
944 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
945 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
946 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
947 elseif 1 " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
948 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
949 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
950 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
951 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
952 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
953 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
954 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
955 func T16_H() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
956 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
957 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
958 elseif 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
959 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
960 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
961 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
962 else " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
963 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
964 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
965 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
966 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
967 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
968 func T16_I() abort |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
969 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
970 Xpath 'a' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
971 elseif 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
972 Xpath 'b' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
973 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
974 Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
975 elseif 1 " aborts function |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
976 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
977 else |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
978 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
979 endif |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
980 Xpath 'f' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
981 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
982 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
983 func Test_Multi_Else() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
984 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
985 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
986 call T16_F() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
987 catch /E583:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
988 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
989 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
990 call assert_equal('be', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
991 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
992 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
993 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
994 call T16_G() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
995 catch /E584:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
996 Xpath 'f' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
997 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
998 call assert_equal('bf', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
999 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1000 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1001 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1002 call T16_H() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1003 catch /E583:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1004 Xpath 'f' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1005 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1006 call assert_equal('cf', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1007 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1008 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1009 try |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1010 call T16_I() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1011 catch /E584:/ |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1012 Xpath 'g' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1013 endtry |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1014 call assert_equal('cg', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1015 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1016 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1017 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1018 " Test 17: Nesting of unmatched :if or :endif inside a :while {{{1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1019 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1020 " The :while/:endwhile takes precedence in nesting over an unclosed |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1021 " :if or an unopened :endif. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1022 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1023 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1024 " While loops inside a function are continued on error. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1025 func T17_F() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1026 let loops = 3 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1027 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1028 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1029 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1030 if (loops == 1) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1031 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1032 continue |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1033 elseif (loops == 0) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1034 Xpath 'c' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1035 break |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1036 elseif 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1037 Xpath 'd' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1038 " endif missing! |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1039 endwhile " :endwhile after :if 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1040 Xpath 'e' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1041 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1042 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1043 func T17_G() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1044 let loops = 2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1045 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1046 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1047 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1048 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1049 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1050 " endif missing |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1051 endwhile " :endwhile after :if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1052 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1053 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1054 func T17_H() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1055 let loops = 2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1056 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1057 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1058 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1059 " if missing! |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1060 endif " :endif without :if in while |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1061 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1062 endwhile |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1063 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1064 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1065 " Error continuation outside a function is at the outermost :endwhile or :endif. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1066 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1067 let v:errmsg = '' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1068 let loops = 2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1069 while loops > 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1070 let loops -= 1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1071 Xpath 'a' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1072 if 0 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1073 Xpath 'b' . loops |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1074 " endif missing! Following :endwhile fails. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1075 endwhile | Xpath 'c' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1076 Xpath 'd' |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1077 call assert_match('E171:', v:errmsg) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1078 call assert_equal('a1d', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1079 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1080 func Test_unmatched_if_in_while() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1081 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1082 call assert_fails('call T17_F()', 'E171:') |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1083 call assert_equal('a2d2a1b1a0c0e', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1084 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1085 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1086 call assert_fails('call T17_G()', 'E171:') |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1087 call assert_equal('a1a0', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1088 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1089 XpathINIT |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1090 call assert_fails('call T17_H()', 'E580:') |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1091 call assert_equal('a1b1a0b0', g:Xpath) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1092 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1093 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1094 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1095 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1096 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1097 " Test 87 using (expr) ? funcref : funcref {{{1 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1098 " |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1099 " Vim needs to correctly parse the funcref and even when it does |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1100 " not execute the funcref, it needs to consume the trailing () |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1101 "------------------------------------------------------------------------------- |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1102 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1103 func Add2(x1, x2) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1104 return a:x1 + a:x2 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1105 endfu |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1106 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1107 func GetStr() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1108 return "abcdefghijklmnopqrstuvwxyp" |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1109 endfu |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1110 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1111 func Test_funcref_with_condexpr() |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1112 call assert_equal(5, function('Add2')(2,3)) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1113 |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1114 call assert_equal(3, 1 ? function('Add2')(1,2) : function('Add2')(2,3)) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1115 call assert_equal(5, 0 ? function('Add2')(1,2) : function('Add2')(2,3)) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1116 " Make sure, GetStr() still works. |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1117 call assert_equal('abcdefghijk', GetStr()[0:10]) |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1118 endfunc |
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
1119 |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 " 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
|
1121 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1122 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 func Test_curlies() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 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
|
1125 let ns = 's' |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 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
|
1127 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 let g:a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1129 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
|
1130 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
|
1131 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
|
1132 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1133 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1134 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1135 " 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
|
1136 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1137 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1138 func Test_type() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1139 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
|
1140 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
|
1141 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
|
1142 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
|
1143 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
|
1144 call assert_equal(4, type({})) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1145 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1146 call assert_equal(5, type(0.0)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1147 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1148 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
|
1149 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
|
1150 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
|
1151 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
|
1152 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
|
1153 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
|
1154 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
|
1155 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
|
1156 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
|
1157 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
|
1158 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
|
1159 call assert_equal(v:t_dict, type({})) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1160 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1161 call assert_equal(v:t_float, type(0.0)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1162 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1163 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
|
1164 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
|
1165 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
|
1166 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
|
1167 |
19548
9a9ca0e622c8
patch 8.2.0331: internal error when using test_void() and test_unknown()
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
1168 call assert_fails("call type(test_void())", 'E685:') |
9a9ca0e622c8
patch 8.2.0331: internal error when using test_void() and test_unknown()
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
1169 call assert_fails("call type(test_unknown())", 'E685:') |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1170 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1171 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
|
1172 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
|
1173 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
|
1174 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
|
1175 |
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('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
|
1177 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
|
1178 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
|
1179 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
|
1180 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1181 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
|
1182 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
|
1183 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
|
1184 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
|
1185 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
|
1186 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
|
1187 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1188 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
|
1189 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
|
1190 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
|
1191 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
|
1192 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1193 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
|
1194 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
|
1195 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
|
1196 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
|
1197 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1198 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
|
1199 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
|
1200 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
|
1201 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
|
1202 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1203 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
|
1204 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
|
1205 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
|
1206 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
|
1207 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
|
1208 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
|
1209 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1210 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
|
1211 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
|
1212 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
|
1213 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
|
1214 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
|
1215 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
|
1216 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1217 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
|
1218 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
|
1219 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
|
1220 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
|
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_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
|
1223 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
|
1224 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
|
1225 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
|
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([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
|
1228 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
|
1229 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
|
1230 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
|
1231 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1232 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
|
1233 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
|
1234 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
|
1235 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
|
1236 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1237 func ChangeYourMind() |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1238 try |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1239 return v:true |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1240 finally |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1241 return 'something else' |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1242 endtry |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1243 endfunc |
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 call ChangeYourMind() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1246 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1247 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1248 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1249 " 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
|
1250 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1251 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1252 func Test_skip() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 let l = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1258 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
|
1259 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
|
1260 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
|
1261 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
|
1262 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
|
1263 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
|
1264 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
|
1265 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
|
1266 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
|
1267 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
|
1268 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
|
1269 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1270 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1271 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1272 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1273 " 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
|
1274 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1275 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1276 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
|
1277 " String |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1278 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
|
1279 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1280 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1281 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1282 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1283 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
|
1284 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
|
1285 \ "'foo bar'"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1286 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1287 " Float |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1288 if has('float') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1289 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
|
1290 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1291 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1292 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1293 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1294 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
|
1295 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
|
1296 \ "-1.2"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1297 endif |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1298 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1299 " Funcref |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1300 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1301 echo function('string') |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1302 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
|
1303 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1304 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
|
1305 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
|
1306 \ "function('string')"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1307 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1308 " Recursive dictionary |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1309 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1310 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
|
1311 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1312 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1313 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1314 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1315 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
|
1316 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
|
1317 \ "{'a': {...}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1318 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1319 " Recursive list |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1320 let a = [0] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1321 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
|
1322 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1323 echo a |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1324 echo string(a) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1325 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1326 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
|
1327 call assert_equal(["[[...]]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1328 \ "[[...]]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1329 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1330 " 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
|
1331 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1332 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1333 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
|
1334 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
|
1335 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1336 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
|
1337 call assert_equal(["[{}, {}, {}]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1338 \ "[{}, {}, {}]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1339 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1340 " 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
|
1341 let a = {} |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1342 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
|
1343 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1344 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1345 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1346 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1347 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
|
1348 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
|
1349 \ "{'a': {}, 'b': {}}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1350 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1351 " 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
|
1352 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1353 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1354 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
|
1355 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
|
1356 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1357 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
|
1358 call assert_equal(["[[], [], []]", |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1359 \ "[[], [], []]"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1360 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1361 " 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
|
1362 let a = [] |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1363 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
|
1364 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1365 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1366 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1367 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1368 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
|
1369 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
|
1370 \ "{'a': [], 'b': []}"], l) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1371 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1372 " 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
|
1373 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
|
1374 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1375 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
|
1376 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
|
1377 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1378 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
|
1379 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
|
1380 \ "[{'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
|
1381 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1382 " 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
|
1383 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
|
1384 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
|
1385 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1386 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1387 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1388 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1389 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
|
1390 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
|
1391 \ "{'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
|
1392 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1393 " 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
|
1394 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
|
1395 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1396 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
|
1397 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
|
1398 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1399 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
|
1400 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
|
1401 \ "[[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
|
1402 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1403 " 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
|
1404 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
|
1405 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
|
1406 redir => result |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1407 echo b |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1408 echo string(b) |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1409 redir END |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1410 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
|
1411 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
|
1412 \ "{'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
|
1413 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1414 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1415 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1416 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1417 " 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
|
1418 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1419 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1420 func Test_num64() |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1421 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
|
1422 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
|
1423 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
|
1424 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
|
1425 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1426 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
|
1427 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
|
1428 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
|
1429 |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1430 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1431 call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1432 call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150)) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1433 endif |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1434 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1435 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
|
1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1441 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1442 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1443 " 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
|
1444 "------------------------------------------------------------------------------- |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1445 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1446 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
|
1447 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
|
1448 exec func |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1449 endfunction |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1450 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1451 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
|
1452 " :append |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1453 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1454 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1455 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1456 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1457 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1458 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1459 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1460 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
|
1461 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1462 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1463 call DefineFunction('T_Append', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1464 \ 'append', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1465 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1466 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1467 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
|
1468 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1469 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
|
1470 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1471 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1472 " :change |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1473 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1474 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1475 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1476 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1477 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1478 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1479 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1480 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
|
1481 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1482 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1483 call DefineFunction('T_Change', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1484 \ 'change', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1485 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1486 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1487 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
|
1488 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1489 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
|
1490 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1491 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1492 " :insert |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1493 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1494 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1495 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1496 \ 'py <<EOS', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1497 \ '.', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1498 \ ]) |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1499 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1500 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
|
1501 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1502 try |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1503 call DefineFunction('T_Insert', [ |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1504 \ 'insert', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1505 \ 'abc', |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1506 \ ]) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1507 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
|
1508 catch |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1509 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
|
1510 endtry |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1511 endfunc |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1512 |
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1513 "------------------------------------------------------------------------------- |
11352
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1514 " 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
|
1515 " |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
13351
diff
changeset
|
1516 " 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
|
1517 " 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
|
1518 "------------------------------------------------------------------------------- |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1519 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
|
1520 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1521 \ |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1522 endfunc |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1523 |
251f1833db7d
patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
1524 "------------------------------------------------------------------------------- |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1525 " Test 97: bitwise functions {{{1 |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1526 "------------------------------------------------------------------------------- |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1527 func Test_bitwise_functions() |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1528 " and |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1529 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
|
1530 call assert_equal(16, and(127, 16)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
1531 eval 127->and(16)->assert_equal(16) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1532 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
|
1533 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
|
1534 call assert_fails("call and({}, 1)", 'E728:') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1535 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1536 call assert_fails("call and(1.0, 1)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1537 call assert_fails("call and(1, 1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1538 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1539 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
|
1540 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
|
1541 " or |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1542 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
|
1543 call assert_equal(15, or(8, 7)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
1544 eval 8->or(7)->assert_equal(15) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1545 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
|
1546 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
|
1547 call assert_fails("call or({}, 1)", 'E728:') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1548 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1549 call assert_fails("call or(1.0, 1)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1550 call assert_fails("call or(1, 1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1551 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1552 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
|
1553 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
|
1554 " xor |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1555 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
|
1556 call assert_equal(111, xor(127, 16)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
1557 eval 127->xor(16)->assert_equal(111) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1558 call assert_equal(255, xor(127, 128)) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1559 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1560 call assert_fails("call xor(1.0, 1)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1561 call assert_fails("call xor(1, 1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1562 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1563 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
|
1564 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
|
1565 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
|
1566 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
|
1567 " invert |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1568 call assert_equal(65408, and(invert(127), 65535)) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
1569 eval 127->invert()->and(65535)->assert_equal(65408) |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1570 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
|
1571 call assert_equal(65407, and(invert(128), 65535)) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1572 if has('float') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1573 call assert_fails("call invert(1.0)", 'E805:') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1574 endif |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1575 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
|
1576 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
|
1577 endfunc |
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
1578 |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1579 " 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
|
1580 func Test_endfunction_trailing() |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1581 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
|
1582 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1583 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
|
1584 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
|
1585 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
|
1586 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1587 unlet done |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1588 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1589 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
|
1590 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
|
1591 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
|
1592 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1593 unlet done |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1594 |
11569
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1595 " trailing line break |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1596 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
|
1597 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
|
1598 delfunc Xtest |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1599 |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1600 set verbose=1 |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1601 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
|
1602 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
|
1603 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
|
1604 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1605 |
11561
7ad79766365a
patch 8.0.0663: unexpected error message only when 'verbose' is set
Christian Brabandt <cb@256bit.org>
parents:
11547
diff
changeset
|
1606 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
|
1607 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
|
1608 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
|
1609 delfunc Xtest |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1610 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
|
1611 |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1612 function Foo() |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1613 echo 'hello' |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1614 endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' |
7003f241b6c7
patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents:
11561
diff
changeset
|
1615 delfunc Foo |
11543
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1616 endfunc |
57c452316da1
patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
1617 |
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
|
1618 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
|
1619 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
|
1620 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
|
1621 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
|
1622 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
|
1623 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
|
1624 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
|
1625 delfunc! Xtest |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19548
diff
changeset
|
1626 |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19548
diff
changeset
|
1627 " Try deleting the current function |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19548
diff
changeset
|
1628 call assert_fails('delfunc Test_delfunction_force', 'E131:') |
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
|
1629 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
|
1630 |
11547
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1631 " 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
|
1632 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
|
1633 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
|
1634 Ni! |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1635 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
|
1636 unlet nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1637 delcommand Nieuw |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1638 endfunc |
3d03ed329a54
patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents:
11545
diff
changeset
|
1639 |
12523
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1640 " Test for script-local function |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1641 func <SID>DoLast() |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1642 call append(line('$'), "last line") |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1643 endfunc |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1644 |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1645 func s:DoNothing() |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1646 call append(line('$'), "nothing line") |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1647 endfunc |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1648 |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1649 func Test_script_local_func() |
18556
ed9690c0f27c
patch 8.1.2272: test may hang at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
18504
diff
changeset
|
1650 set nocp nomore viminfo+=nviminfo |
12523
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1651 new |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1652 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
|
1653 |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1654 normal _x |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1655 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
|
1656 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
|
1657 enew! | close |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1658 endfunc |
881564b89f9b
patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11569
diff
changeset
|
1659 |
19035
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1660 func Test_script_expand_sfile() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1661 let lines =<< trim END |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1662 func s:snr() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1663 return expand('<sfile>') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1664 endfunc |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1665 let g:result = s:snr() |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1666 END |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1667 call writefile(lines, 'Xexpand') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1668 source Xexpand |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1669 call assert_match('<SNR>\d\+_snr', g:result) |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1670 source Xexpand |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1671 call assert_match('<SNR>\d\+_snr', g:result) |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1672 |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1673 call delete('Xexpand') |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1674 unlet g:result |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1675 endfunc |
b920ae62c7b1
patch 8.2.0078: expanding <sfile> works differently the second time
Bram Moolenaar <Bram@vim.org>
parents:
18556
diff
changeset
|
1676 |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1677 func Test_compound_assignment_operators() |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1678 " Test for number |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1679 let x = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1680 let x += 10 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1681 call assert_equal(11, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1682 let x -= 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1683 call assert_equal(6, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1684 let x *= 4 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1685 call assert_equal(24, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1686 let x /= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1687 call assert_equal(8, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1688 let x %= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1689 call assert_equal(2, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1690 let x .= 'n' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1691 call assert_equal('2n', x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1692 |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1693 " Test special cases: division or modulus with 0. |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1694 let x = 1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1695 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1696 call assert_equal(0x7FFFFFFFFFFFFFFF, x) |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1697 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1698 let x = -1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1699 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1700 call assert_equal(-0x7FFFFFFFFFFFFFFF, x) |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1701 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1702 let x = 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1703 let x /= 0 |
19427
fdfe44ac6a1a
patch 8.2.0271: the "num64" feature is available everywhere
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1704 call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x) |
15969
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1705 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1706 let x = 1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1707 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1708 call assert_equal(0, x) |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1709 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1710 let x = -1 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1711 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1712 call assert_equal(0, x) |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1713 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1714 let x = 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1715 let x %= 0 |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1716 call assert_equal(0, x) |
9cc42db77a54
patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents:
15790
diff
changeset
|
1717 |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1718 " Test for string |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1719 let x = 'str' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1720 let x .= 'ing' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1721 call assert_equal('string', x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1722 let x += 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1723 call assert_equal(1, x) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1724 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1725 if has('float') |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1726 " Test for float |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1727 let x -= 1.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1728 call assert_equal(-0.5, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1729 let x = 0.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1730 let x += 4.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1731 call assert_equal(5.0, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1732 let x -= 1.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1733 call assert_equal(3.5, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1734 let x *= 3.0 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1735 call assert_equal(10.5, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1736 let x /= 2.5 |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1737 call assert_equal(4.2, x) |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1738 call assert_fails('let x %= 0.5', 'E734') |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
19035
diff
changeset
|
1739 call assert_fails('let x .= "f"', 'E734') |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
1740 let x = !3.14 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
1741 call assert_equal(0.0, x) |
15790
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1742 endif |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1743 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1744 " Test for environment variable |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1745 let $FOO = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1746 call assert_fails('let $FOO += 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1747 call assert_fails('let $FOO -= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1748 call assert_fails('let $FOO *= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1749 call assert_fails('let $FOO /= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1750 call assert_fails('let $FOO %= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1751 let $FOO .= 's' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1752 call assert_equal('1s', $FOO) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1753 unlet $FOO |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1754 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1755 " Test for option variable (type: number) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1756 let &scrolljump = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1757 let &scrolljump += 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1758 call assert_equal(6, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1759 let &scrolljump -= 2 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1760 call assert_equal(4, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1761 let &scrolljump *= 3 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1762 call assert_equal(12, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1763 let &scrolljump /= 2 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1764 call assert_equal(6, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1765 let &scrolljump %= 5 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1766 call assert_equal(1, &scrolljump) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1767 call assert_fails('let &scrolljump .= "j"', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1768 set scrolljump&vim |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1769 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1770 " Test for register |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1771 let @/ = 1 |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1772 call assert_fails('let @/ += 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1773 call assert_fails('let @/ -= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1774 call assert_fails('let @/ *= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1775 call assert_fails('let @/ /= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1776 call assert_fails('let @/ %= 1', 'E734') |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1777 let @/ .= 's' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1778 call assert_equal('1s', @/) |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1779 let @/ = '' |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1780 endfunc |
05d836c8f1c4
patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1781 |
16078
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1782 func Test_refcount() |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1783 " Immediate values |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1784 call assert_equal(-1, test_refcount(1)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1785 call assert_equal(-1, test_refcount('s')) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1786 call assert_equal(-1, test_refcount(v:true)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1787 call assert_equal(0, test_refcount([])) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1788 call assert_equal(0, test_refcount({})) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1789 call assert_equal(0, test_refcount(0zff)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1790 call assert_equal(0, test_refcount({-> line('.')})) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1791 if has('float') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1792 call assert_equal(-1, test_refcount(0.1)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1793 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1794 if has('job') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1795 call assert_equal(0, test_refcount(job_start([&shell, &shellcmdflag, 'echo .']))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1796 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1797 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1798 " No refcount types |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1799 let x = 1 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1800 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1801 let x = 's' |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1802 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1803 let x = v:true |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1804 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1805 if has('float') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1806 let x = 0.1 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1807 call assert_equal(-1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1808 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1809 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1810 " Check refcount |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1811 let x = [] |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1812 call assert_equal(1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1813 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1814 let x = {} |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
1815 call assert_equal(1, x->test_refcount()) |
16078
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1816 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1817 let x = 0zff |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1818 call assert_equal(1, test_refcount(x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1819 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1820 let X = {-> line('.')} |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1821 call assert_equal(1, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1822 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1823 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1824 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1825 if has('job') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1826 let job = job_start([&shell, &shellcmdflag, 'echo .']) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1827 call assert_equal(1, test_refcount(job)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1828 call assert_equal(1, test_refcount(job_getchannel(job))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1829 call assert_equal(1, test_refcount(job)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1830 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1831 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1832 " Function arguments, copying and unassigning |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1833 func ExprCheck(x, i) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1834 let i = a:i + 1 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1835 call assert_equal(i, test_refcount(a:x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1836 let Y = a:x |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1837 call assert_equal(i + 1, test_refcount(a:x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1838 call assert_equal(test_refcount(a:x), test_refcount(Y)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1839 let Y = 0 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1840 call assert_equal(i, test_refcount(a:x)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1841 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1842 call ExprCheck([], 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1843 call ExprCheck({}, 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1844 call ExprCheck(0zff, 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1845 call ExprCheck({-> line('.')}, 0) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1846 if has('job') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1847 call ExprCheck(job, 1) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1848 call ExprCheck(job_getchannel(job), 1) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1849 call job_stop(job) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1850 endif |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1851 delfunc ExprCheck |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1852 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1853 " Regarding function |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1854 func Func(x) abort |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1855 call assert_equal(2, test_refcount(function('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1856 call assert_equal(0, test_refcount(funcref('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1857 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1858 call assert_equal(1, test_refcount(function('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1859 call assert_equal(0, test_refcount(function('Func', [1]))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1860 call assert_equal(0, test_refcount(funcref('Func'))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1861 call assert_equal(0, test_refcount(funcref('Func', [1]))) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1862 let X = function('Func') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1863 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1864 call assert_equal(1, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1865 let X = function('Func', [1]) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1866 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1867 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1868 let X = funcref('Func') |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1869 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1870 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1871 let X = funcref('Func', [1]) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1872 let Y = X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1873 call assert_equal(2, test_refcount(X)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1874 unlet X |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1875 unlet Y |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1876 call Func(1) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1877 delfunc Func |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1878 |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1879 " Function with dict |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1880 func DictFunc() dict |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1881 call assert_equal(3, test_refcount(self)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1882 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1883 let d = {'Func': function('DictFunc')} |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1884 call assert_equal(1, test_refcount(d)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1885 call assert_equal(0, test_refcount(d.Func)) |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1886 call d.Func() |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1887 unlet d |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1888 delfunc DictFunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1889 endfunc |
d13aa9c5a1d1
patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents:
15969
diff
changeset
|
1890 |
17184
a5c3d374e1d3
patch 8.1.1591: on error garbage collection may free memory in use
Bram Moolenaar <Bram@vim.org>
parents:
17127
diff
changeset
|
1891 func Test_funccall_garbage_collect() |
17127
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1892 func Func(x, ...) |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1893 call add(a:x, a:000) |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1894 endfunc |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1895 call Func([], []) |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1896 " Must not crash cause by invalid freeing |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1897 call test_garbagecollect_now() |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1898 call assert_true(v:true) |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1899 delfunc Func |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1900 endfunc |
d244a9be99db
patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents:
16760
diff
changeset
|
1901 |
17251
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1902 func Test_function_defined_line() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17251
diff
changeset
|
1903 CheckNotGui |
17251
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1904 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1905 let lines =<< trim [CODE] |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1906 " F1 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1907 func F1() |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1908 " F2 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1909 func F2() |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1910 " |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1911 " |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1912 " |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1913 return |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1914 endfunc |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1915 " F3 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1916 execute "func F3()\n\n\n\nreturn\nendfunc" |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1917 " F4 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1918 execute "func F4()\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1919 \\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1920 \\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1921 \\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1922 \return\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1923 \endfunc" |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1924 endfunc |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1925 " F5 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1926 execute "func F5()\n\n\n\nreturn\nendfunc" |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1927 " F6 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1928 execute "func F6()\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1929 \\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1930 \\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1931 \\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1932 \return\n |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1933 \endfunc" |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1934 call F1() |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1935 verbose func F1 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1936 verbose func F2 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1937 verbose func F3 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1938 verbose func F4 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1939 verbose func F5 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1940 verbose func F6 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1941 qall! |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1942 [CODE] |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1943 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1944 call writefile(lines, 'Xtest.vim') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
1945 let res = system(GetVimCommandClean() .. ' -es -X -S Xtest.vim') |
17251
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1946 call assert_equal(0, v:shell_error) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1947 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1948 let m = matchstr(res, 'function F1()[^[:print:]]*[[:print:]]*') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1949 call assert_match(' line 2$', m) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1950 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1951 let m = matchstr(res, 'function F2()[^[:print:]]*[[:print:]]*') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1952 call assert_match(' line 4$', m) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1953 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1954 let m = matchstr(res, 'function F3()[^[:print:]]*[[:print:]]*') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1955 call assert_match(' line 11$', m) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1956 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1957 let m = matchstr(res, 'function F4()[^[:print:]]*[[:print:]]*') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1958 call assert_match(' line 13$', m) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1959 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1960 let m = matchstr(res, 'function F5()[^[:print:]]*[[:print:]]*') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1961 call assert_match(' line 21$', m) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1962 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1963 let m = matchstr(res, 'function F6()[^[:print:]]*[[:print:]]*') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1964 call assert_match(' line 23$', m) |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1965 |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1966 call delete('Xtest.vim') |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1967 endfunc |
984eef966002
patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
17184
diff
changeset
|
1968 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1969 " Test for missing :endif, :endfor, :endwhile and :endtry {{{1 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1970 func Test_missing_end() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1971 call writefile(['if 2 > 1', 'echo ">"'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1972 call assert_fails('source Xscript', 'E171:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1973 call writefile(['for i in range(5)', 'echo i'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1974 call assert_fails('source Xscript', 'E170:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1975 call writefile(['while v:true', 'echo "."'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1976 call assert_fails('source Xscript', 'E170:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1977 call writefile(['try', 'echo "."'], 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1978 call assert_fails('source Xscript', 'E600:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
1979 call delete('Xscript') |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1980 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1981 " Using endfor with :while |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1982 let caught_e732 = 0 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1983 try |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1984 while v:true |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1985 endfor |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1986 catch /E732:/ |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1987 let caught_e732 = 1 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1988 endtry |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1989 call assert_equal(1, caught_e732) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1990 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1991 " Using endwhile with :for |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1992 let caught_e733 = 0 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1993 try |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1994 for i in range(1) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1995 endwhile |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1996 catch /E733:/ |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1997 let caught_e733 = 1 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1998 endtry |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
1999 call assert_equal(1, caught_e733) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
2000 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
2001 " Missing 'in' in a :for statement |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19427
diff
changeset
|
2002 call assert_fails('for i range(1) | endfor', 'E690:') |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2003 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2004 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2005 " Test for deep nesting of if/for/while/try statements {{{1 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2006 func Test_deep_nest() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2007 if !CanRunVimInTerminal() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2008 throw 'Skipped: cannot run vim in terminal' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2009 endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2010 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2011 let lines =<< trim [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2012 " Deep nesting of if ... endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2013 func Test1() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2014 let @a = join(repeat(['if v:true'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2015 let @a ..= "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2016 let @a ..= join(repeat(['endif'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2017 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2018 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2019 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2020 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2021 " Deep nesting of for ... endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2022 func Test2() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2023 let @a = join(repeat(['for i in [1]'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2024 let @a ..= "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2025 let @a ..= join(repeat(['endfor'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2026 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2027 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2028 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2029 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2030 " Deep nesting of while ... endwhile |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2031 func Test3() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2032 let @a = join(repeat(['while v:true'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2033 let @a ..= "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2034 let @a ..= join(repeat(['endwhile'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2035 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2036 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2037 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2038 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2039 " Deep nesting of try ... endtry |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2040 func Test4() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2041 let @a = join(repeat(['try'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2042 let @a ..= "\necho v:true\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2043 let @a ..= join(repeat(['endtry'], 51), "\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2044 @a |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2045 let @a = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2046 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2047 [SCRIPT] |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2048 call writefile(lines, 'Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2049 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2050 let buf = RunVimInTerminal('-S Xscript', {'rows': 6}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2051 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2052 " Deep nesting of if ... endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2053 call term_sendkeys(buf, ":call Test1()\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2054 call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2055 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2056 " Deep nesting of for ... endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2057 call term_sendkeys(buf, ":call Test2()\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2058 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2059 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2060 " Deep nesting of while ... endwhile |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2061 call term_sendkeys(buf, ":call Test3()\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2062 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2063 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2064 " Deep nesting of try ... endtry |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2065 call term_sendkeys(buf, ":call Test4()\n") |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2066 call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))}) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2067 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2068 "let l = '' |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2069 "for i in range(1, 6) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2070 " let l ..= term_getline(buf, i) . "\n" |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2071 "endfor |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2072 "call assert_report(l) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2073 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2074 call StopVimInTerminal(buf) |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2075 call delete('Xscript') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2076 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
2077 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2078 " Test for <sfile>, <slnum> in a function {{{1 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2079 func Test_sfile_in_function() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2080 func Xfunc() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2081 call assert_match('..Test_sfile_in_function\[5]..Xfunc', expand('<sfile>')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2082 call assert_equal('2', expand('<slnum>')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2083 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2084 call Xfunc() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2085 delfunc Xfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2086 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
2087 |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2088 " Test for errors in converting to float from various types {{{1 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2089 func Test_float_conversion_errors() |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2090 if has('float') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2091 call assert_fails('let x = 4.0 % 2.0', 'E804') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2092 call assert_fails('echo 1.1[0]', 'E806') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2093 call assert_fails('echo sort([function("min"), 1], "f")', 'E891:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2094 call assert_fails('echo 3.2 == "vim"', 'E892:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2095 call assert_fails('echo sort([[], 1], "f")', 'E893:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2096 call assert_fails('echo sort([{}, 1], "f")', 'E894:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2097 call assert_fails('echo 3.2 == v:true', 'E362:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2098 call assert_fails('echo 3.2 == v:none', 'E907:') |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2099 endif |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2100 endfunc |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19689
diff
changeset
|
2101 |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11352
diff
changeset
|
2102 "------------------------------------------------------------------------------- |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2103 " Modelines {{{1 |
18504
ece46bd3c9af
patch 8.1.2246: some tests are still in old style
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
2104 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |
10942
e05695e59f6d
patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2105 "------------------------------------------------------------------------------- |