annotate src/testdir/test_vimscript.vim @ 17657:0da9bc55c31a v8.1.1826

patch 8.1.1826: tests use hand coded feature and option checks commit https://github.com/vim/vim/commit/8c5a278fc508da6dfe50e69b6ee734451aa4eafb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 7 23:07:07 2019 +0200 patch 8.1.1826: tests use hand coded feature and option checks Problem: Tests use hand coded feature and option checks. Solution: Use the commands from check.vim in more tests.
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Aug 2019 23:15:07 +0200
parents 984eef966002
children 131f1d8c5860
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17251
diff changeset
5
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 " Test environment {{{1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
10 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
11 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
12
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " 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
14 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
15 split messages
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 $put =a:text
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 wq
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 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
21
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " 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
23 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " 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
25 " 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
26 " 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
27 " 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
28 " 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
29 " file.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
30 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
31 let script = tempname()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 execute "redir! >" . script
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 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
34 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 execute "edit" script
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " 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
37 " 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
38 " 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
39 " 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
40 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
41 /^\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
42 %s/^\d*//e
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 %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
44 %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
45 normal gg0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 let cnt = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 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
48 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
49 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
50 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 g/^\s*$/d
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 write
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 bwipeout
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 return script
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
55 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " 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
58 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " 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
60 " 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
61 " 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
62 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
63 function! ExecAsScript(funcname)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " 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
65 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
66
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 " 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
68 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
69 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
70 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
71 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 function! DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 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
75 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
76 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
77 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 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
81
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 " 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
85 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " 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
87 " :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
88 " 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
89 " tests will hang.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 "-------------------------------------------------------------------------------
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 function! T1_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 let first = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 if first
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 let first = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 function! T1_G()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 let first = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 if first
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 let first = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 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
122 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 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
126 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call T1_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 Xpath 'F'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 try
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 call T1_G()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 catch
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 " Catch missing :endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 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
135 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 Xpath 'G'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 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
140 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141
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 " 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
144 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 " 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
146 " :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
147 " 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
148 " on an error.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 " 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
151 " 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
152 "-------------------------------------------------------------------------------
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 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
155 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 ExecAsScript T1_F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 Xpath 'F'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 try
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 ExecAsScript T1_G
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 catch
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 " Catch missing :endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 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
165 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 Xpath 'G'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 call DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 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
171 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172
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 " 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
175 "-------------------------------------------------------------------------------
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 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
178 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 let loops = 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 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
183 if loops <= 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 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
185 let loops = -1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 Xpath 'b' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 if (loops == 2)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 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
191 Xpath 'c' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 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
193 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
194 Xpath 'd' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 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
197 Xpath 'e' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 elseif (loops == 1)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 let p = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 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
201 Xpath 'f' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 let p = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 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
204 Xpath 'g' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 Xpath 'h' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 unlet p
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 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
209 Xpath 'i' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 if (loops > 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 Xpath 'j' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 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
215 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
216 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
217 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
218 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 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
224 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 unlet break_err
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 unlet loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 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
231 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232
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 " 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
235 "-------------------------------------------------------------------------------
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 function! T4_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 let loops = 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 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
242 Xpath 'b' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 if (loops == 2)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 Xpath 'c' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 Xpath 'd' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 Xpath 'e' . loops
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 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
250 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 function Test_return()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 call T4_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 Xpath '4'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 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
263 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265
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 " 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
268 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 " 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
270 " 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
271 "-------------------------------------------------------------------------------
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 function Test_finish()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 ExecAsScript T4_F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 Xpath '5'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 call DeleteTheScript()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 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
280 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283
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 " 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
286 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 " 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
288 " 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
289 " 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
290 " 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
291 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 " 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
293 " 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
294 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 " 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
299 " 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
300 " 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
301 " 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
302 " 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
303 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 let calls = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 com! -nargs=1 CALL
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
306 \ if !exists("calls") && !exists("outer") |
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
307 \ 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
308 \ endif
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 let i = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 while i < 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 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
313 if i == 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 function! F1(arg)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317 let outer = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319 let j = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320 while j < 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
322 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
323 function! G1(arg)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
324 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
325 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 continue
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 Xpath 'e' . i
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
335 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
336 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
337 let outer = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
339 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
340 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
342 let k = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 while k < 3
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 Xpath 'g' . k
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345 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
346 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
347 CALL a:arg
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 Xpath 'h' . k
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 if exists("*G1")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
359 if exists("*F1")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 call F1("F1")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
361 if exists("*G1")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
362 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
363 endif
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
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366 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
367 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 if exists("*F2")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 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
371 if exists("*G21")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
372 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
373 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
374 if exists("*G22")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
375 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
376 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377 if exists("*G23")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
378 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
379 endif
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
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382 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
383 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
385 if exists("*F3")
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 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
387 if exists("*G31")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
388 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
389 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 if exists("*G32")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
391 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
392 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 if exists("*G33")
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
394 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
395 endif
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
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 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
401 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
402
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 unlet calls
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 delfunction F1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 delfunction G1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 delfunction F2
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 delfunction G21
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 delfunction G22
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 delfunction G23
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 delfunction G31
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 delfunction G32
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 delfunction G33
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 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
415 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
416 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
417 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418
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 " 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
421 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 " 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
423 " 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
424 " 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
425 " line.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
430 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
431 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
432 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 endwhile | Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439 endif | Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 endif | Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 endwhile | Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 Xpath 'n'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 Xpath 'o'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 asdf | Xpath 'p'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 Xpath 'q'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 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
461
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 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
463 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
464 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465
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 " 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
468 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 " 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
470 " 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
471 " 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
472 " "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
473 " 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
474 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 function! T8_F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
481 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 asdf | Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
489 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 endif | Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 asdf | Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 Xpath 'n'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 endwhile | Xpath 'o'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 Xpath 'p'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507 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
508 Xpath 'q'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509 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
510 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 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
513 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514 Xpath 'r'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
515 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
516 Xpath 's'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517 asdf " returns -1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 Xpath 't'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
520 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521 Xpath 'v'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522 endif | Xpath 'w'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
523 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
524
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 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
526 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 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
529 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530 Xpath 'A'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 Xpath 'B'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533 asdf " returns -1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534 Xpath 'C'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
536 Xpath 'D'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 endwhile | Xpath 'E'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 Xpath 'F'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 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
542 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544 " 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
545 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
546 Xpath 'X'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 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
548
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 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
550 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
551 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
552
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 delfunction T8_F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 delfunction T8_G
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 delfunction T8_H
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558
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 " 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
561 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 " 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
563 " 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
564 " "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
565 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 function! F() abort
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
571 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
572 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 if result != 2
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
576 return 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
579 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
580 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581 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
582 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
583 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
584 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
585 return 2
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
586 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
587
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588 function! H() abort
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
589 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 call I() " aborted
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
591 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
592 return 4
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
593 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
594
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
595 function! I() abort
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
596 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
597 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
598 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
599 return 8
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
600 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
601
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
602 if F() != 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
603 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
604 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
605
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
606 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
607
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
608 delfunction F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
609 delfunction G
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
610 delfunction H
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
611 delfunction I
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
612
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
613 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
614 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
615 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
616
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
617
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 " 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
620 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
621 " 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
622 " 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
623 " be recognized.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
624 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
627
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
628 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
629 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
630 if a:enr == ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
631 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
632 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
633 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
634 let match = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
635 if v:errmsg !~ '^'.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
636 let match = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
637 if v:errmsg == ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
638 Xout "Message missing."
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
639 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
640 let v:errmsg = escape(v:errmsg, '"')
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
641 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
642 endif
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 return match
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
645 endfunc
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
647 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
648 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
649 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
650 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
651
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
652 if 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
653 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
654 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
655 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
656 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
657
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
658 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
659 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
660 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
661 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
662 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
663
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
664 let v:errmsg = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
665 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
666 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
667 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
668 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
669 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
670 Xpath 'm'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
671 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
672
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
673 let v:errmsg = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674 if 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
675 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
676 Xpath 'o'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
677 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
678 Xpath 'p'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
679 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
680 Xpath 'q'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
681 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
682
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
683 let v:errmsg = ""
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
684 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
685 Xpath 's'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
686 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
687 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
688 Xpath 't'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
689 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
690 Xpath 'u'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
691 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
692
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
693 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
694 delfunction MSG
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
695
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
696 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
697 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
698 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
699
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
700
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 " 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
703 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
704 " 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
705 " 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
706 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
709
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
710 let calls = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
711
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
712 function! P(num)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
713 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
714 return 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
715 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
716
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
717 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
718 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
719 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
720 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
721 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
722 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
723 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
724 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
725 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
726 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
727 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
728 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
729 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
730 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
731 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
732 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
733 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
734 Xpath 'x'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
735
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
736 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
737 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
738
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
739 unlet calls
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
740 delfunction P
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
741
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
742 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
743 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
744 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
745 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
746
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
747
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 " 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
750 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
751 " 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
752 " 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
753 " 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
754 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
757
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
758 function! NULL()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
759 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
760 return 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
761 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
762
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
763 function! ZERO()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
764 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
765 return 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
766 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
767
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
768 function! F0()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
769 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
770 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
771
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
772 function! F1(arg)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
773 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
774 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
775
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
776 let V0 = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
777
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
778 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
779 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
780
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
781 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
782 if 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
783 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
784 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
785 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
786
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
787 Xpath 'i'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
788 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
789 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
790 Xpath 'j'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
791 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
792 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
793
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
794 Xpath 'k'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
795 if 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
796 asdf " error
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
797 Xpath 'l'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
798 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
799 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
800
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
801 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
802
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
803 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
804 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
805 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
806
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
807
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 " 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
810 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
811 " 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
812 " 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
813 " 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
814 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
817
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
818 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
819 while asdf
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
820 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821 while 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
822 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
823 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
824 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
825 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
826 break
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
827 endwhile
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
828 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
829
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
830 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
831 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
832 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
833
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
834 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
835 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
836 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
837
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
838
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 " 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
841 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
842 " 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
843 " 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
844 " 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
845 " are executed.
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
846 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
849
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
850 function! F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
851 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
852 let x = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
853 if x " false
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
854 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
855 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
856 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
857 let x = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
858 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
859 Xpath 'd'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
860 else
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
861 Xpath 'e'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
862 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
863 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
864 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
865 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
866 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
867 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
868 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
869
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
870 let boolvar = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
871 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
872 Xpath '-'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
873
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
874 unlet boolvar
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
875 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
876 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
877
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
878 delfunction F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
879
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
880 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
881 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
882 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
883
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
884
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 " 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
887 "
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
888 " 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
889 " 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
890 "-------------------------------------------------------------------------------
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 XpathINIT
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
893
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
894 function! F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
895 Xpath 'a'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
896 let x = 0
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
897 if x " false
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
898 Xpath 'b'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
899 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
900 Xpath 'c'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
901 let x = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
902 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
903 Xpath 'f'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
904 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
905 Xpath 'g'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
906 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
907 Xpath 'h'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
908 endfunction
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
909
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
910 let boolvar = 1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
911 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
912 Xpath '-'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
913
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
914 unlet boolvar
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
915 call F()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
916 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
917
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
918 delfunction F
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
919
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
920 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
921 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
922 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
923
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 " 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
926 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
927
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
928 func Test_curlies()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
929 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
930 let ns = 's'
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
931 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
932
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
933 let g:a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
934 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
935 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
936 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
937 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
938
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
939 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
940 " 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
941 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
943 func Test_type()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
944 call assert_equal(0, type(0))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
945 call assert_equal(1, type(""))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
946 call assert_equal(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
947 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
948 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
949 call assert_equal(4, type({}))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
950 call assert_equal(5, type(0.0))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
951 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
952 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
953 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
954 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
955 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
956 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
957 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
958 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
959 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
960 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
961 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
962 call assert_equal(v:t_dict, type({}))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
963 call assert_equal(v:t_float, type(0.0))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
964 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
965 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
966 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
967 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
968
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
969
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
970 call assert_equal(0, 0 + v:false)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
971 call assert_equal(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
972 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
973 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
974
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
975 call assert_equal('v:false', '' . v:false)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
976 call assert_equal('v:true', '' . v:true)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
977 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
978 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
979
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
980 call assert_true(v:false == 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
981 call assert_false(v:false != 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
982 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
983 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
984 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
985 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
986
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
987 call assert_true(v:null == 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
988 call assert_false(v:null != 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
989 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
990 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
991
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
992 call assert_true(v: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
993 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
994 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
995 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
996
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
997 call assert_false(v: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
998 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
999 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
1000 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
1001
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1002 call assert_false(v:false is 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1003 call assert_false(v:true is 1)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1004 call assert_false(v: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
1005 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
1006 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
1007 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
1008
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1009 call assert_true(v:false isnot 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1010 call assert_true(v:true isnot 1)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1011 call assert_true(v: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
1012 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
1013 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
1014 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
1015
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1016 call assert_equal(v: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
1017 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
1018 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
1019 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
1020
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1021 call assert_equal(v: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
1022 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
1023 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
1024 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
1025
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1026 call assert_equal([v: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
1027 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
1028 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
1029 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
1030
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1031 call assert_true(empty(v:false))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1032 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
1033 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
1034 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
1035
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1036 func ChangeYourMind()
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1037 try
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1038 return v:true
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1039 finally
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1040 return 'something else'
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1041 endtry
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1042 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1043
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1044 call ChangeYourMind()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1045 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1046
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1047 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1048 " 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
1049 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1050
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1051 func Test_skip()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1052 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
1053 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
1054 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
1055 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
1056 let l = []
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1057 call assert_false(0 && l[1])
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1058 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
1059 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
1060 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
1061 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
1062 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
1063 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
1064 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
1065 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
1066 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
1067 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
1068
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1069 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1070
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1071 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1072 " 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
1073 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1074
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1075 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
1076 " String
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1077 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
1078 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1079 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1080 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1081 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1082 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
1083 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
1084 \ "'foo bar'"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1085
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1086 " Float
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1087 if has('float')
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1088 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
1089 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1090 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1091 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1092 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1093 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
1094 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
1095 \ "-1.2"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1096 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1097
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1098 " Funcref
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1099 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1100 echo function('string')
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1101 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
1102 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1103 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
1104 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
1105 \ "function('string')"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1106
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1107 " Recursive dictionary
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1108 let a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1109 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
1110 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1111 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1112 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1113 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1114 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
1115 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
1116 \ "{'a': {...}}"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1117
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1118 " Recursive list
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1119 let a = [0]
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1120 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
1121 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1122 echo a
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1123 echo string(a)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1124 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1125 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
1126 call assert_equal(["[[...]]",
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1127 \ "[[...]]"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1128
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1129 " 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
1130 let a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1131 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1132 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
1133 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
1134 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1135 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
1136 call assert_equal(["[{}, {}, {}]",
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1137 \ "[{}, {}, {}]"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1138
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1139 " 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
1140 let a = {}
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1141 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
1142 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1143 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1144 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1145 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1146 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
1147 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
1148 \ "{'a': {}, 'b': {}}"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1149
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1150 " 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
1151 let a = []
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1152 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1153 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
1154 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
1155 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1156 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
1157 call assert_equal(["[[], [], []]",
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1158 \ "[[], [], []]"], l)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1159
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1160 " 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
1161 let a = []
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1162 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
1163 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1164 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1165 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1166 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1167 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
1168 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
1169 \ "{'a': [], 'b': []}"], l)
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 " 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
1172 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
1173 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1174 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
1175 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
1176 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1177 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
1178 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
1179 \ "[{'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
1180
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1181 " 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
1182 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
1183 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
1184 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1185 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1186 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1187 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1188 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
1189 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
1190 \ "{'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
1191
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1192 " 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
1193 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
1194 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1195 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
1196 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
1197 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1198 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
1199 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
1200 \ "[[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
1201
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1202 " 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
1203 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
1204 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
1205 redir => result
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1206 echo b
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1207 echo string(b)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1208 redir END
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1209 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
1210 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
1211 \ "{'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
1212
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1213 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1214
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1215 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1216 " 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
1217 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1218
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1219 func Test_num64()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1220 if !has('num64')
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1221 return
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1222 endif
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1223
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1224 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
1225 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
1226 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
1227 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
1228
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1229 call assert_equal( 9223372036854775807, 1 / 0)
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(-9223372036854775807, -1 / 0)
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1231 call assert_equal(-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
1232
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1233 call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1234 call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150))
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1235
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1236 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
1237 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
1238 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
1239 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
1240 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
1241 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1242
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1243 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1244 " 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
1245 "-------------------------------------------------------------------------------
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1246
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1247 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
1248 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
1249 exec func
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1250 endfunction
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_script_lines()
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1253 " :append
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1254 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1255 call DefineFunction('T_Append', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1256 \ 'append',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1257 \ 'py <<EOS',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1258 \ '.',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1259 \ ])
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1260 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1261 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
1262 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1263 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1264 call DefineFunction('T_Append', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1265 \ 'append',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1266 \ 'abc',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1267 \ ])
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1268 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
1269 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1270 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
1271 endtry
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 " :change
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1274 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1275 call DefineFunction('T_Change', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1276 \ 'change',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1277 \ 'py <<EOS',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1278 \ '.',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1279 \ ])
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1280 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1281 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
1282 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1283 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1284 call DefineFunction('T_Change', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1285 \ 'change',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1286 \ 'abc',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1287 \ ])
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1288 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
1289 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1290 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
1291 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1292
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1293 " :insert
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1294 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1295 call DefineFunction('T_Insert', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1296 \ 'insert',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1297 \ 'py <<EOS',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1298 \ '.',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1299 \ ])
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1300 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1301 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
1302 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1303 try
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1304 call DefineFunction('T_Insert', [
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1305 \ 'insert',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1306 \ 'abc',
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1307 \ ])
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1308 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
1309 catch
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1310 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
1311 endtry
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1312 endfunc
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1313
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1314 "-------------------------------------------------------------------------------
11352
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
1315 " 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
1316 "
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13351
diff changeset
1317 " 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
1318 " 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
1319 "-------------------------------------------------------------------------------
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
1320 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
1321
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
1322 \
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
1323 endfunc
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
1324
251f1833db7d patch 8.0.0561: undefined behavior when using backslash after empty line
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
1325 "-------------------------------------------------------------------------------
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1326 " Test 97: bitwise functions {{{1
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1327 "-------------------------------------------------------------------------------
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1328 func Test_bitwise_functions()
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1329 " and
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1330 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
1331 call assert_equal(16, and(127, 16))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1332 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
1333 call assert_fails("call and(1.0, 1)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1334 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
1335 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
1336 call assert_fails("call and(1, 1.0)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1337 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
1338 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
1339 " or
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1340 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
1341 call assert_equal(15, or(8, 7))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1342 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
1343 call assert_fails("call or(1.0, 1)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1344 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
1345 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
1346 call assert_fails("call or(1, 1.0)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1347 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
1348 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
1349 " xor
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1350 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
1351 call assert_equal(111, xor(127, 16))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1352 call assert_equal(255, xor(127, 128))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1353 call assert_fails("call xor(1.0, 1)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1354 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
1355 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
1356 call assert_fails("call xor(1, 1.0)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1357 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
1358 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
1359 " invert
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1360 call assert_equal(65408, and(invert(127), 65535))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1361 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
1362 call assert_equal(65407, and(invert(128), 65535))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1363 call assert_fails("call invert(1.0)", 'E805:')
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1364 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
1365 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
1366 endfunc
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1367
11543
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1368 " 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
1369 func Test_endfunction_trailing()
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1370 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
1371
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1372 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
1373 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
1374 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
1375 delfunc Xtest
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1376 unlet done
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1377
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1378 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
1379 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
1380 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
1381 delfunc Xtest
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1382 unlet done
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1383
11569
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1384 " trailing line break
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1385 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
1386 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
1387 delfunc Xtest
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1388
11543
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1389 set verbose=1
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1390 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
1391 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
1392 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
1393 delfunc Xtest
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1394
11561
7ad79766365a patch 8.0.0663: unexpected error message only when 'verbose' is set
Christian Brabandt <cb@256bit.org>
parents: 11547
diff changeset
1395 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
1396 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
1397 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
1398 delfunc Xtest
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1399 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
1400
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1401 function Foo()
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1402 echo 'hello'
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1403 endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
7003f241b6c7 patch 8.0.0667: memory access error when command follows :endfunc
Christian Brabandt <cb@256bit.org>
parents: 11561
diff changeset
1404 delfunc Foo
11543
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1405 endfunc
57c452316da1 patch 8.0.0654: no warning for text after :endfunction
Christian Brabandt <cb@256bit.org>
parents: 11461
diff changeset
1406
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
1407 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
1408 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
1409 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
1410 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
1411 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
1412 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
1413 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
1414 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
1415 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
1416
11547
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
1417 " 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
1418 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
1419 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
1420 Ni!
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
1421 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
1422 unlet nieuw
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
1423 delcommand Nieuw
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
1424 endfunc
3d03ed329a54 patch 8.0.0656: cannot use ! after some user commands
Christian Brabandt <cb@256bit.org>
parents: 11545
diff changeset
1425
12523
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1426 " Test for script-local function
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1427 func <SID>DoLast()
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1428 call append(line('$'), "last line")
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1429 endfunc
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1430
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1431 func s:DoNothing()
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1432 call append(line('$'), "nothing line")
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1433 endfunc
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1434
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1435 func Test_script_local_func()
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1436 set nocp viminfo+=nviminfo
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1437 new
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1438 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
1439
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1440 normal _x
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1441 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
1442 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
1443 enew! | close
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1444 endfunc
881564b89f9b patch 8.0.1140: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11569
diff changeset
1445
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1446 func Test_compound_assignment_operators()
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1447 " Test for number
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1448 let x = 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1449 let x += 10
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1450 call assert_equal(11, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1451 let x -= 5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1452 call assert_equal(6, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1453 let x *= 4
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1454 call assert_equal(24, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1455 let x /= 3
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1456 call assert_equal(8, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1457 let x %= 3
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1458 call assert_equal(2, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1459 let x .= 'n'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1460 call assert_equal('2n', x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1461
15969
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1462 " 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
1463 let x = 1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1464 let x /= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1465 if has('num64')
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1466 call assert_equal(0x7FFFFFFFFFFFFFFF, x)
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1467 else
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1468 call assert_equal(0x7fffffff, x)
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1469 endif
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1470
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1471 let x = -1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1472 let x /= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1473 if has('num64')
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1474 call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1475 else
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1476 call assert_equal(-0x7fffffff, x)
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1477 endif
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1478
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1479 let x = 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1480 let x /= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1481 if has('num64')
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1482 call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1483 else
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1484 call assert_equal(-0x7FFFFFFF - 1, x)
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1485 endif
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1486
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1487 let x = 1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1488 let x %= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1489 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
1490
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1491 let x = -1
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1492 let x %= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1493 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
1494
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1495 let x = 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1496 let x %= 0
9cc42db77a54 patch 8.1.0990: floating point exception with "%= 0" and "/= 0"
Bram Moolenaar <Bram@vim.org>
parents: 15790
diff changeset
1497 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
1498
15790
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1499 " Test for string
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1500 let x = 'str'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1501 let x .= 'ing'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1502 call assert_equal('string', x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1503 let x += 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1504 call assert_equal(1, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1505 let x -= 1.5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1506 call assert_equal(-0.5, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1507
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1508 if has('float')
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1509 " Test for float
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1510 let x = 0.5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1511 let x += 4.5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1512 call assert_equal(5.0, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1513 let x -= 1.5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1514 call assert_equal(3.5, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1515 let x *= 3.0
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1516 call assert_equal(10.5, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1517 let x /= 2.5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1518 call assert_equal(4.2, x)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1519 call assert_fails('let x %= 0.5', 'E734')
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1520 call assert_fails('let x .= "f"', 'E734')
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1521 endif
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1522
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1523 " Test for environment variable
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1524 let $FOO = 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1525 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
1526 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
1527 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
1528 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
1529 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
1530 let $FOO .= 's'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1531 call assert_equal('1s', $FOO)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1532 unlet $FOO
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1533
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1534 " 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
1535 let &scrolljump = 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1536 let &scrolljump += 5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1537 call assert_equal(6, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1538 let &scrolljump -= 2
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1539 call assert_equal(4, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1540 let &scrolljump *= 3
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1541 call assert_equal(12, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1542 let &scrolljump /= 2
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1543 call assert_equal(6, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1544 let &scrolljump %= 5
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1545 call assert_equal(1, &scrolljump)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1546 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
1547 set scrolljump&vim
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1548
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1549 " Test for register
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1550 let @/ = 1
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1551 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
1552 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
1553 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
1554 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
1555 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
1556 let @/ .= 's'
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1557 call assert_equal('1s', @/)
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1558 let @/ = ''
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1559 endfunc
05d836c8f1c4 patch 8.1.0902: incomplete set of assignment operators
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
1560
16078
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1561 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
1562 " 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
1563 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
1564 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
1565 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
1566 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
1567 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
1568 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
1569 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
1570 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
1571 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
1572 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1573 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
1574 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
1575 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1576
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1577 " 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
1578 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
1579 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
1580 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
1581 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
1582 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
1583 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
1584 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
1585 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
1586 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
1587 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1588
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1589 " 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
1590 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
1591 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
1592
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1593 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
1594 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
1595
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1596 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
1597 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
1598
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1599 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
1600 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
1601 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
1602 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
1603
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1604 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
1605 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
1606 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
1607 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
1608 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
1609 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1610
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1611 " 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
1612 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
1613 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
1614 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
1615 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
1616 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
1617 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
1618 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
1619 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
1620 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1621 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
1622 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
1623 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
1624 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
1625 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
1626 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
1627 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
1628 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
1629 endif
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1630 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
1631
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1632 " 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
1633 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
1634 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
1635 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
1636 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1637 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
1638 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
1639 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
1640 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
1641 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
1642 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
1643 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
1644 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
1645 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
1646 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
1647 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
1648 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
1649 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
1650 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
1651 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
1652 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
1653 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
1654 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
1655 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
1656 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
1657
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1658 " 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
1659 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
1660 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
1661 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1662 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
1663 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
1664 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
1665 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
1666 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
1667 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
1668 endfunc
d13aa9c5a1d1 patch 8.1.1044: no way to check the reference count of objects
Bram Moolenaar <Bram@vim.org>
parents: 15969
diff changeset
1669
17184
a5c3d374e1d3 patch 8.1.1591: on error garbage collection may free memory in use
Bram Moolenaar <Bram@vim.org>
parents: 17127
diff changeset
1670 func Test_funccall_garbage_collect()
17127
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1671 func Func(x, ...)
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1672 call add(a:x, a:000)
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1673 endfunc
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1674 call Func([], [])
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1675 " 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
1676 call test_garbagecollect_now()
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1677 call assert_true(v:true)
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1678 delfunc Func
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1679 endfunc
d244a9be99db patch 8.1.1563: crash when using closures
Bram Moolenaar <Bram@vim.org>
parents: 16760
diff changeset
1680
17251
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1681 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
1682 CheckNotGui
17251
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1683
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1684 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
1685 " F1
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1686 func F1()
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1687 " F2
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1688 func F2()
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1689 "
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1690 "
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1691 "
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1692 return
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1693 endfunc
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1694 " F3
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1695 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
1696 " F4
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1697 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
1698 \\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1699 \\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1700 \\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1701 \return\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1702 \endfunc"
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1703 endfunc
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1704 " F5
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1705 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
1706 " F6
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1707 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
1708 \\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1709 \\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1710 \\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1711 \return\n
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1712 \endfunc"
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1713 call F1()
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1714 verbose func F1
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1715 verbose func F2
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1716 verbose func F3
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1717 verbose func F4
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1718 verbose func F5
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1719 verbose func F6
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1720 qall!
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1721 [CODE]
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1722
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1723 call writefile(lines, 'Xtest.vim')
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1724 let res = system(v:progpath .. ' --clean -es -X -S Xtest.vim')
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1725 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
1726
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1727 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
1728 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
1729
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1730 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
1731 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
1732
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1733 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
1734 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
1735
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1736 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
1737 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
1738
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1739 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
1740 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
1741
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1742 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
1743 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
1744
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1745 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
1746 endfunc
984eef966002 patch 8.1.1625: script line numbers are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 17184
diff changeset
1747
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 11352
diff changeset
1748 "-------------------------------------------------------------------------------
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1749 " Modelines {{{1
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1750 " vim: ts=8 sw=4 tw=80 fdm=marker
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1751 "-------------------------------------------------------------------------------