diff options
-rw-r--r-- | src/nvim/testdir/Makefile | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_eval.in | 234 | ||||
-rw-r--r-- | src/nvim/testdir/test_eval.ok | bin | 10814 -> 0 bytes | |||
-rw-r--r-- | src/nvim/testdir/test_eval_func.vim | 12 |
4 files changed, 1 insertions, 247 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index e27ac227c8..41ce2daa91 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -7,7 +7,7 @@ export SHELL := sh VIMPROG := ../../../build/bin/nvim SCRIPTSOURCE := ../../../runtime -SCRIPTS := test_eval.out \ +SCRIPTS := \ test8.out test10.out \ test11.out test12.out test13.out test14.out \ test17.out \ diff --git a/src/nvim/testdir/test_eval.in b/src/nvim/testdir/test_eval.in deleted file mode 100644 index 54cdb03ba2..0000000000 --- a/src/nvim/testdir/test_eval.in +++ /dev/null @@ -1,234 +0,0 @@ -Test for various eval features. vim: set ft=vim : - -Note: system clipboard is saved, changed and restored. - -clipboard contents -something else - -STARTTEST -:so small.vim -:set noswapfile -:lang C -:fun AppendRegContents(reg) - call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1))) -:endfun -:fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1) - call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1)) -endfun -:command -nargs=? AR :call AppendRegContents(<q-args>) -:fun SetReg(...) - call call('setreg', a:000) - call append('$', printf('{{{2 setreg(%s)', string(a:000)[1:-2])) - call AppendRegContents(a:1) - if a:1 isnot# '=' - execute "silent normal! Go==\n==\e\"".a:1."P" - endif -endfun -:fun ErrExe(str) - call append('$', 'Executing '.a:str) - try - execute a:str - catch - $put =v:exception - endtry -endfun -:fun Test() -$put ='{{{1 let tests' -let @" = 'abc' -AR " -let @" = "abc\n" -AR " -let @" = "abc\<C-m>" -AR " -let @= = '"abc"' -AR = - -$put ='{{{1 Basic setreg tests' -call SetReg('a', 'abcA', 'c') -call SetReg('b', 'abcB', 'v') -call SetReg('c', 'abcC', 'l') -call SetReg('d', 'abcD', 'V') -call SetReg('e', 'abcE', 'b') -call SetReg('f', 'abcF', "\<C-v>") -call SetReg('g', 'abcG', 'b10') -call SetReg('h', 'abcH', "\<C-v>10") -call SetReg('I', 'abcI') - -$put ='{{{1 Appending single lines with setreg()' -call SetReg('A', 'abcAc', 'c') -call SetReg('A', 'abcAl', 'l') -call SetReg('A', 'abcAc2','c') -call SetReg('b', 'abcBc', 'ca') -call SetReg('b', 'abcBb', 'ba') -call SetReg('b', 'abcBc2','ca') -call SetReg('b', 'abcBb2','b50a') - -call SetReg('C', 'abcCl', 'l') -call SetReg('C', 'abcCc', 'c') -call SetReg('D', 'abcDb', 'b') - -call SetReg('E', 'abcEb', 'b') -call SetReg('E', 'abcEl', 'l') -call SetReg('F', 'abcFc', 'c') - -$put ='{{{1 Appending NL with setreg()' -call setreg('a', 'abcA2', 'c') -call setreg('b', 'abcB2', 'v') -call setreg('c', 'abcC2', 'l') -call setreg('d', 'abcD2', 'V') -call setreg('e', 'abcE2', 'b') -call setreg('f', 'abcF2', "\<C-v>") -call setreg('g', 'abcG2', 'b10') -call setreg('h', 'abcH2', "\<C-v>10") -call setreg('I', 'abcI2') - -call SetReg('A', "\n") -call SetReg('B', "\n", 'c') -call SetReg('C', "\n") -call SetReg('D', "\n", 'l') -call SetReg('E', "\n") -call SetReg('F', "\n", 'b') - -$put ='{{{1 Setting lists with setreg()' -call SetReg('a', ['abcA3'], 'c') -call SetReg('b', ['abcB3'], 'l') -call SetReg('c', ['abcC3'], 'b') -call SetReg('d', ['abcD3']) -call SetReg('e', [1, 2, 'abc', 3]) -call SetReg('f', [1, 2, 3]) - -$put ='{{{1 Appending lists with setreg()' -call SetReg('A', ['abcA3c'], 'c') -call SetReg('b', ['abcB3l'], 'la') -call SetReg('C', ['abcC3b'], 'lb') -call SetReg('D', ['abcD32']) - -call SetReg('A', ['abcA32']) -call SetReg('B', ['abcB3c'], 'c') -call SetReg('C', ['abcC3l'], 'l') -call SetReg('D', ['abcD3b'], 'b') - -$put ='{{{1 Appending lists with NL with setreg()' -call SetReg('A', ["\n", 'abcA3l2'], 'l') -call SetReg('B', ["\n", 'abcB3c2'], 'c') -call SetReg('C', ["\n", 'abcC3b2'], 'b') -call SetReg('D', ["\n", 'abcD3b50'],'b50') - -$put ='{{{1 Setting lists with NLs with setreg()' -call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"]) -call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c') -call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l') -call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b') -call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10') - -$put ='{{{1 Search and expressions' -call SetReg('/', ['abc/']) -call SetReg('/', ["abc/\n"]) -call SetReg('=', ['"abc/"']) -call SetReg('=', ["\"abc/\n\""]) -$put ='{{{1 System clipboard' -if has('clipboard') -" Save and restore system clipboard. -" If no connection to X-Server is possible, test should succeed. -let _clipreg = ['*', getreg('*'), getregtype('*')] -let _clipopt = &cb -let &cb='unnamed' -5y -AR * -tabdo :windo :echo "hi" -6y -AR * -let &cb=_clipopt -call call('setreg', _clipreg) -else - call AppendRegParts('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']") - call AppendRegParts('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']") -endif -$put ='{{{1 Errors' -call ErrExe('call setreg()') -call ErrExe('call setreg(1)') -call ErrExe('call setreg(1, 2, 3, 4)') -call ErrExe('call setreg([], 2)') -call ErrExe('call setreg(1, {})') -call ErrExe('call setreg(1, 2, [])') -call ErrExe('call setreg("/", ["1", "2"])') -call ErrExe('call setreg("=", ["1", "2"])') -call ErrExe('call setreg(1, ["", "", [], ""])') -endfun -:" -:call Test() -:" -:delfunction SetReg -:delfunction AppendRegContents -:delfunction ErrExe -:delfunction Test -:delcommand AR -:call garbagecollect(1) -:" -:/^start:/+1,$wq! test.out -:" vim: et ts=4 isk-=\: fmr=???,??? -:call getchar() -:e test.out -:%d - -:" 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: diff --git a/src/nvim/testdir/test_eval.ok b/src/nvim/testdir/test_eval.ok Binary files differdeleted file mode 100644 index cf7a5cd418..0000000000 --- a/src/nvim/testdir/test_eval.ok +++ /dev/null diff --git a/src/nvim/testdir/test_eval_func.vim b/src/nvim/testdir/test_eval_func.vim deleted file mode 100644 index 48d01df27d..0000000000 --- a/src/nvim/testdir/test_eval_func.vim +++ /dev/null @@ -1,12 +0,0 @@ -" Vim script used in test_eval.in. Needed for script-local function. - -func! s:Testje() - return "foo" -endfunc - -let Bar = function('s:Testje') - -$put ='s:Testje exists: ' . exists('s:Testje') -$put ='func s:Testje exists: ' . exists('*s:Testje') -$put ='Bar exists: ' . exists('Bar') -$put ='func Bar exists: ' . exists('*Bar') |