annotate src/testdir/test34.in @ 8686:92657771648f v7.4.1632

commit https://github.com/vim/vim/commit/6098957458e538682f54e23de217da06200876a3 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 21 22:38:34 2016 +0100 patch 7.4.1632 Problem: List of test targets is outdated. Solution: Update to current list of test targets.
author Christian Brabandt <cb@256bit.org>
date Mon, 21 Mar 2016 22:45:05 +0100
parents 60a5b7b82016
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
1 Test for user functions.
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
2 Also test an <expr> mapping calling a function.
3687
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
3 Also test that a builtin function cannot be replaced.
5473
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
4 Also test for regression when calling arbitrary expression.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 STARTTEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 :so small.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 :function Table(title, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 : let ret = a:title
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 : let idx = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 : while idx <= a:0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 : exe "let ret = ret . a:" . idx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 : let idx = idx + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 : endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 : return ret
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 :endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 :function Compute(n1, n2, divname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 : if a:n2 == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 : return "fail"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 : endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 : exe "let g:" . a:divname . " = ". a:n1 / a:n2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 : return "ok"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 :endfunction
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
24 :func Expr1()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
25 : normal! v
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
26 : return "111"
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
27 :endfunc
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
28 :func Expr2()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
29 : call search('XX', 'b')
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
30 : return "222"
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
31 :endfunc
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
32 :func ListItem()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
33 : let g:counter += 1
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
34 : return g:counter . '. '
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
35 :endfunc
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
36 :func ListReset()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
37 : let g:counter = 0
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
38 : return ''
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
39 :endfunc
2179
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
40 :func FuncWithRef(a)
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
41 : unlet g:FuncRef
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
42 : return a:a
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
43 :endfunc
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
44 :let g:FuncRef=function("FuncWithRef")
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
45 :let counter = 0
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
46 :inoremap <expr> ( ListItem()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
47 :inoremap <expr> [ ListReset()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
48 :imap <expr> + Expr1()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
49 :imap <expr> * Expr2()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 :let retval = "nop"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 /^here
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 C=Table("xxx", 4, "asdf")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 =Compute(45, 0, "retval")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 =retval
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 =Compute(45, 5, "retval")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 =retval
2179
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
57 =g:FuncRef(333)
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
58
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
59 XX+-XX
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
60 ---*---
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
61 (one
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
62 (two
3687
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
63 [(one again:call append(line('$'), max([1, 2, 3]))
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
64 :call extend(g:, {'max': function('min')})
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
65 :call append(line('$'), max([1, 2, 3]))
5473
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
66 :try
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
67 : " Regression: the first line below used to throw ?E110: Missing ')'?
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
68 : " Second is here just to prove that this line is correct when not skipping
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
69 : " rhs of &&.
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
70 : $put =(0&&(function('tr'))(1, 2, 3))
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
71 : $put =(1&&(function('tr'))(1, 2, 3))
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
72 :catch
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
73 : $put ='!!! Unexpected exception:'
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
74 : $put =v:exception
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
75 :endtry
60a5b7b82016 updated for version 7.4.086
Bram Moolenaar <bram@vim.org>
parents: 3687
diff changeset
76 :$-9,$w! test.out
1405
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
77 :delfunc Table
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
78 :delfunc Compute
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
79 :delfunc Expr1
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
80 :delfunc Expr2
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
81 :delfunc ListItem
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
82 :delfunc ListReset
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
83 :unlet retval counter
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
84 :q!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 ENDTEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 here