Bram Moolenaar | 19a1669 | 2016-09-01 22:19:47 +0200 | [diff] [blame^] | 1 | "Tests for nested functions |
2 | " | ||||
3 | function! NestedFunc() | ||||
4 | fu! Func1() | ||||
5 | let g:text .= 'Func1 ' | ||||
6 | endfunction | ||||
7 | call Func1() | ||||
8 | fu! s:func2() | ||||
9 | let g:text .= 's:func2 ' | ||||
10 | endfunction | ||||
11 | call s:func2() | ||||
12 | fu! s:_func3() | ||||
13 | let g:text .= 's:_func3 ' | ||||
14 | endfunction | ||||
15 | call s:_func3() | ||||
16 | let fn = 'Func4' | ||||
17 | fu! {fn}() | ||||
18 | let g:text .= 'Func4 ' | ||||
19 | endfunction | ||||
20 | call {fn}() | ||||
21 | let fn = 'func5' | ||||
22 | fu! s:{fn}() | ||||
23 | let g:text .= 's:func5' | ||||
24 | endfunction | ||||
25 | call s:{fn}() | ||||
26 | endfunction | ||||
27 | |||||
28 | function! Test_nested_functions() | ||||
29 | let g:text = '' | ||||
30 | call NestedFunc() | ||||
31 | call assert_equal('Func1 s:func2 s:_func3 Func4 s:func5', g:text) | ||||
32 | endfunction |