diff options
| author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-05-12 02:25:17 +0200 |
|---|---|---|
| committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-05-15 20:46:01 +0200 |
| commit | da51dc9cf202772f60bd2da975dbef257bd9237c (patch) | |
| tree | 5c16b93238a153f55634e9323077f30c8133970c /src/nvim/testdir/test34.in | |
| parent | ffe61e5ba1721340ca51d56bae3ddaca415fb5bc (diff) | |
| download | rneovim-da51dc9cf202772f60bd2da975dbef257bd9237c.tar.gz rneovim-da51dc9cf202772f60bd2da975dbef257bd9237c.tar.bz2 rneovim-da51dc9cf202772f60bd2da975dbef257bd9237c.zip | |
Introduce nvim namespace: Move files.
Move files from src/ to src/nvim/.
- src/nvim/ becomes the new root dir for nvim executable sources.
- src/libnvim/ is planned to become root dir of the neovim library.
Diffstat (limited to 'src/nvim/testdir/test34.in')
| -rw-r--r-- | src/nvim/testdir/test34.in | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/nvim/testdir/test34.in b/src/nvim/testdir/test34.in new file mode 100644 index 0000000000..71ee5f63b2 --- /dev/null +++ b/src/nvim/testdir/test34.in @@ -0,0 +1,87 @@ +Test for user functions. +Also test an <expr> mapping calling a function. +Also test that a builtin function cannot be replaced. +Also test for regression when calling arbitrary expression. + +STARTTEST +:so small.vim +:function Table(title, ...) +: let ret = a:title +: let idx = 1 +: while idx <= a:0 +: exe "let ret = ret . a:" . idx +: let idx = idx + 1 +: endwhile +: return ret +:endfunction +:function Compute(n1, n2, divname) +: if a:n2 == 0 +: return "fail" +: endif +: exe "let g:" . a:divname . " = ". a:n1 / a:n2 +: return "ok" +:endfunction +:func Expr1() +: normal! v +: return "111" +:endfunc +:func Expr2() +: call search('XX', 'b') +: return "222" +:endfunc +:func ListItem() +: let g:counter += 1 +: return g:counter . '. ' +:endfunc +:func ListReset() +: let g:counter = 0 +: return '' +:endfunc +:func FuncWithRef(a) +: unlet g:FuncRef +: return a:a +:endfunc +:let g:FuncRef=function("FuncWithRef") +:let counter = 0 +:inoremap <expr> ( ListItem() +:inoremap <expr> [ ListReset() +:imap <expr> + Expr1() +:imap <expr> * Expr2() +:let retval = "nop" +/^here +C=Table("xxx", 4, "asdf") + =Compute(45, 0, "retval") + =retval + =Compute(45, 5, "retval") + =retval + =g:FuncRef(333) + +XX+-XX +---*--- +(one +(two +[(one again:call append(line('$'), max([1, 2, 3])) +:call extend(g:, {'max': function('min')}) +:call append(line('$'), max([1, 2, 3])) +:try +: " Regression: the first line below used to throw ?E110: Missing ')'? +: " Second is here just to prove that this line is correct when not skipping +: " rhs of &&. +: $put =(0&&(function('tr'))(1, 2, 3)) +: $put =(1&&(function('tr'))(1, 2, 3)) +:catch +: $put ='!!! Unexpected exception:' +: $put =v:exception +:endtry +:$-9,$w! test.out +:delfunc Table +:delfunc Compute +:delfunc Expr1 +:delfunc Expr2 +:delfunc ListItem +:delfunc ListReset +:unlet retval counter +:q! +ENDTEST + +here |