1"Tests for nested functions 2" 3func NestedFunc() 4 func! Func1() 5 let g:text .= 'Func1 ' 6 endfunc 7 call Func1() 8 func! s:func2() 9 let g:text .= 's:func2 ' 10 endfunc 11 call s:func2() 12 func! s:_func3() 13 let g:text .= 's:_func3 ' 14 endfunc 15 call s:_func3() 16 let fn = 'Func4' 17 func! {fn}() 18 let g:text .= 'Func4 ' 19 endfunc 20 call {fn}() 21 let fn = 'func5' 22 func! s:{fn}() 23 let g:text .= 's:func5' 24 endfunc 25 call s:{fn}() 26endfunc 27 28func Test_nested_functions() 29 let g:text = '' 30 call NestedFunc() 31 call assert_equal('Func1 s:func2 s:_func3 Func4 s:func5', g:text) 32endfunction 33 34func Test_nested_argument() 35 func g:X() 36 let g:Y = function('sort') 37 endfunc 38 let g:Y = function('sort') 39 echo g:Y([], g:X()) 40 delfunc g:X 41 unlet g:Y 42endfunc 43