aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_eval.in
blob: a29fefc3b668ebca5470d3be700a8a8a6223ae67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
STARTTEST
:so small.vim
:set encoding=latin1
:set noswapfile

:" function name not starting with a capital
:try
:  func! g:test()
:    echo "test"
:  endfunc
:catch
:  $put =v:exception
:endtry

:" function name folowed by #
:try
:  func! test2() "#
:    echo "test2"
:  endfunc
:catch
:  $put =v:exception
:endtry

:" function name includes a colon
:try
:  func! b:test()
:    echo "test"
:  endfunc
:catch
:  $put =v:exception
:endtry

:" function name starting with/without "g:", buffer-local funcref.
:function! g:Foo(n)
:  $put ='called Foo(' . a:n . ')'
:endfunction
:let b:my_func = function('Foo')
:call b:my_func(1)
:echo g:Foo(2)
:echo Foo(3)

:" script-local function used in Funcref must exist.
:so test_eval_func.vim

:" using $ instead of '$' must give an error
:try
:  call append($, 'foobar')
:catch
:  $put =v:exception
:endtry

:$put ='{{{1 getcurpos/setpos'
/^012345678
6l:let sp = getcurpos()
0:call setpos('.', sp)
jyl:$put

:/^start:/+1,$wq! test.out
:" vim: et ts=4 isk-=\: fmr=???,???
:call getchar()
ENDTEST

012345678
012345678

start: