annotate src/testdir/test34.in @ 4071:8819ea6dcb72 v7.3.790

updated for version 7.3.790 Problem: After reloading a buffer the modelines are not processed. Solution: call do_modelines(). (Ken Takata)
author Bram Moolenaar <bram@vim.org>
date Wed, 30 Jan 2013 14:13:56 +0100
parents 085f14642fe8
children 60a5b7b82016
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.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 STARTTEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 :so small.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 :function Table(title, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 : let ret = a:title
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 : let idx = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 : while idx <= a:0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 : exe "let ret = ret . a:" . idx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 : let idx = idx + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 : endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 : return ret
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 :endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 :function Compute(n1, n2, divname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 : if a:n2 == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 : return "fail"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 : endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 : exe "let g:" . a:divname . " = ". a:n1 / a:n2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 : return "ok"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 :endfunction
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
23 :func Expr1()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
24 : normal! v
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
25 : return "111"
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
26 :endfunc
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
27 :func Expr2()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
28 : call search('XX', 'b')
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
29 : return "222"
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
30 :endfunc
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
31 :func ListItem()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
32 : let g:counter += 1
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
33 : return g:counter . '. '
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
34 :endfunc
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
35 :func ListReset()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
36 : let g:counter = 0
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
37 : return ''
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
38 :endfunc
2179
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
39 :func FuncWithRef(a)
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
40 : unlet g:FuncRef
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
41 : return a:a
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
42 :endfunc
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
43 :let g:FuncRef=function("FuncWithRef")
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
44 :let counter = 0
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
45 :inoremap <expr> ( ListItem()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
46 :inoremap <expr> [ ListReset()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
47 :imap <expr> + Expr1()
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
48 :imap <expr> * Expr2()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 :let retval = "nop"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 /^here
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 C=Table("xxx", 4, "asdf")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 =Compute(45, 0, "retval")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 =retval
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 =Compute(45, 5, "retval")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 =retval
2179
cd6e6876308e updated for version 7.2.440
Bram Moolenaar <bram@vim.org>
parents: 1405
diff changeset
56 =g:FuncRef(333)
856
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
57
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
58 XX+-XX
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
59 ---*---
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
60 (one
8cd729851562 updated for version 7.0g
vimboss
parents: 7
diff changeset
61 (two
3687
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
62 [(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
63 :call extend(g:, {'max': function('min')})
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
64 :call append(line('$'), max([1, 2, 3]))
085f14642fe8 updated for version 7.3.603
Bram Moolenaar <bram@vim.org>
parents: 2179
diff changeset
65 :$-7,$w! test.out
1405
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
66 :delfunc Table
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
67 :delfunc Compute
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
68 :delfunc Expr1
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
69 :delfunc Expr2
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
70 :delfunc ListItem
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
71 :delfunc ListReset
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
72 :unlet retval counter
b63792dadc23 updated for version 7.1-120
vimboss
parents: 856
diff changeset
73 :q!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 ENDTEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 here