diff options
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 4 | ||||
-rw-r--r-- | src/testdir/Make_vms.mms | 5 | ||||
-rw-r--r-- | src/testdir/test_eval.in | 119 | ||||
-rw-r--r-- | src/testdir/test_eval.ok | bin | 6716 -> 0 bytes | |||
-rw-r--r-- | src/testdir/test_eval_stuff.vim | 165 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 169 insertions, 127 deletions
diff --git a/src/Makefile b/src/Makefile index c8e0f087fe..0e1ac77050 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2291,7 +2291,6 @@ test_libvterm: # Run individual OLD style test. # These do not depend on the executable, compile it when needed. test1 \ - test_eval \ test42 test44 test49 \ test52 test59 \ test70 \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 772c083347..7fad24b780 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -16,9 +16,7 @@ SCRIPTS_ALL = \ test42.out \ test44.out \ test70.out \ - test99.out \ - test_eval.out - + test99.out # Tests that run on most systems, but not on Amiga. SCRIPTS_MORE1 = \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 5400c158d8..a89bb244fd 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,10 +74,7 @@ VIMPROG = <->vim.exe .SUFFIXES : .out .in SCRIPT = test1.out \ - test42.out test44.out test49.out \ - test77a.out \ - test99.out \ - test_eval.out + test42.out test44.out test49.out test77a.out test99.out # Known problems: # diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in deleted file mode 100644 index ebe1874102..0000000000 --- a/src/testdir/test_eval.in +++ /dev/null @@ -1,119 +0,0 @@ -Test for various eval features. vim: set ft=vim : - -NOTE: Do not add more here, use new style test test_eval_stuff.vim - -Note: system clipboard is saved, changed and restored. - -clipboard contents -something else - -STARTTEST -:so small.vim -:set encoding=latin1 -: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 Test() -$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' -7y -AR * -tabdo :windo :echo "hi" -8y -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 -endfun -:" -:call Test() -:" -:delfunction SetReg -:delfunction AppendRegContents -:delfunction Test -:delcommand AR -:call garbagecollect(1) -:" -:/^start:/+1,$wq! test.out -:" vim: et ts=4 isk-=\: fmr=???,??? -:call getchar() -ENDTEST - -start: diff --git a/src/testdir/test_eval.ok b/src/testdir/test_eval.ok Binary files differdeleted file mode 100644 index 3ae6f6c671..0000000000 --- a/src/testdir/test_eval.ok +++ /dev/null diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index 28350bb3e2..325f8e2a49 100644 --- a/src/testdir/test_eval_stuff.vim +++ b/src/testdir/test_eval_stuff.vim @@ -354,6 +354,171 @@ func Test_setreg_basic() call Assert_reg('I', "v", "abcI", "['abcI']", "abcI", "['abcI']") call Assert_regput('I', ['==', '=abcI=']) + " 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 Assert_reg('A', 'V', "abcA2\n", "['abcA2']", "abcA2\n", "['abcA2']") + call Assert_regput('A', ['==', 'abcA2', '==']) + + call setreg('B', "\n", 'c') + call Assert_reg('B', 'v', "abcB2\n", "['abcB2', '']", "abcB2\n", "['abcB2', '']") + call Assert_regput('B', ['==', '=abcB2', '=']) + + call setreg('C', "\n") + call Assert_reg('C', 'V', "abcC2\n\n", "['abcC2', '']", "abcC2\n\n", "['abcC2', '']") + call Assert_regput('C', ['==', 'abcC2', '', '==']) + + call setreg('D', "\n", 'l') + call Assert_reg('D', 'V', "abcD2\n\n", "['abcD2', '']", "abcD2\n\n", "['abcD2', '']") + call Assert_regput('D', ['==', 'abcD2', '', '==']) + + call setreg('E', "\n") + call Assert_reg('E', 'V', "abcE2\n\n", "['abcE2', '']", "abcE2\n\n", "['abcE2', '']") + call Assert_regput('E', ['==', 'abcE2', '', '==']) + + call setreg('F', "\n", 'b') + call Assert_reg('F', "\<C-V>0", "abcF2\n", "['abcF2', '']", "abcF2\n", "['abcF2', '']") + call Assert_regput('F', ['==', '=abcF2=', ' ']) + + " Setting lists with setreg() + call setreg('a', ['abcA3'], 'c') + call Assert_reg('a', 'v', "abcA3", "['abcA3']", "abcA3", "['abcA3']") + call Assert_regput('a', ['==', '=abcA3=']) + + call setreg('b', ['abcB3'], 'l') + call Assert_reg('b', 'V', "abcB3\n", "['abcB3']", "abcB3\n", "['abcB3']") + call Assert_regput('b', ['==', 'abcB3', '==']) + + call setreg('c', ['abcC3'], 'b') + call Assert_reg('c', "\<C-V>5", "abcC3", "['abcC3']", "abcC3", "['abcC3']") + call Assert_regput('c', ['==', '=abcC3=']) + + call setreg('d', ['abcD3']) + call Assert_reg('d', 'V', "abcD3\n", "['abcD3']", "abcD3\n", "['abcD3']") + call Assert_regput('d', ['==', 'abcD3', '==']) + + call setreg('e', [1, 2, 'abc', 3]) + call Assert_reg('e', 'V', "1\n2\nabc\n3\n", "['1', '2', 'abc', '3']", "1\n2\nabc\n3\n", "['1', '2', 'abc', '3']") + call Assert_regput('e', ['==', '1', '2', 'abc', '3', '==']) + + call setreg('f', [1, 2, 3]) + call Assert_reg('f', 'V', "1\n2\n3\n", "['1', '2', '3']", "1\n2\n3\n", "['1', '2', '3']") + call Assert_regput('f', ['==', '1', '2', '3', '==']) + + " Appending lists with setreg() + call setreg('A', ['abcA3c'], 'c') + call Assert_reg('A', 'v', "abcA3\nabcA3c", "['abcA3', 'abcA3c']", "abcA3\nabcA3c", "['abcA3', 'abcA3c']") + call Assert_regput('A', ['==', '=abcA3', 'abcA3c=']) + + call setreg('b', ['abcB3l'], 'la') + call Assert_reg('b', 'V', "abcB3\nabcB3l\n", "['abcB3', 'abcB3l']", "abcB3\nabcB3l\n", "['abcB3', 'abcB3l']") + call Assert_regput('b', ['==', 'abcB3', 'abcB3l', '==']) + + call setreg('C', ['abcC3b'], 'lb') + call Assert_reg('C', "\<C-V>6", "abcC3\nabcC3b", "['abcC3', 'abcC3b']", "abcC3\nabcC3b", "['abcC3', 'abcC3b']") + call Assert_regput('C', ['==', '=abcC3 =', ' abcC3b']) + + call setreg('D', ['abcD32']) + call Assert_reg('D', 'V', "abcD3\nabcD32\n", "['abcD3', 'abcD32']", "abcD3\nabcD32\n", "['abcD3', 'abcD32']") + call Assert_regput('D', ['==', 'abcD3', 'abcD32', '==']) + + call setreg('A', ['abcA32']) + call Assert_reg('A', 'V', "abcA3\nabcA3c\nabcA32\n", "['abcA3', 'abcA3c', 'abcA32']", "abcA3\nabcA3c\nabcA32\n", "['abcA3', 'abcA3c', 'abcA32']") + call Assert_regput('A', ['==', 'abcA3', 'abcA3c', 'abcA32', '==']) + + call setreg('B', ['abcB3c'], 'c') + call Assert_reg('B', 'v', "abcB3\nabcB3l\nabcB3c", "['abcB3', 'abcB3l', 'abcB3c']", "abcB3\nabcB3l\nabcB3c", "['abcB3', 'abcB3l', 'abcB3c']") + call Assert_regput('B', ['==', '=abcB3', 'abcB3l', 'abcB3c=']) + + call setreg('C', ['abcC3l'], 'l') + call Assert_reg('C', 'V', "abcC3\nabcC3b\nabcC3l\n", "['abcC3', 'abcC3b', 'abcC3l']", "abcC3\nabcC3b\nabcC3l\n", "['abcC3', 'abcC3b', 'abcC3l']") + call Assert_regput('C', ['==', 'abcC3', 'abcC3b', 'abcC3l', '==']) + + call setreg('D', ['abcD3b'], 'b') + call Assert_reg('D', "\<C-V>6", "abcD3\nabcD32\nabcD3b", "['abcD3', 'abcD32', 'abcD3b']", "abcD3\nabcD32\nabcD3b", "['abcD3', 'abcD32', 'abcD3b']") + call Assert_regput('D', ['==', '=abcD3 =', ' abcD32', ' abcD3b']) + + " Appending lists with NL with setreg() + call setreg('A', ["\n", 'abcA3l2'], 'l') + call Assert_reg('A', "V", "abcA3\nabcA3c\nabcA32\n\n\nabcA3l2\n", "['abcA3', 'abcA3c', 'abcA32', '\n', 'abcA3l2']", "abcA3\nabcA3c\nabcA32\n\n\nabcA3l2\n", "['abcA3', 'abcA3c', 'abcA32', '\n', 'abcA3l2']") + call Assert_regput('A', ['==', 'abcA3', 'abcA3c', 'abcA32', "\n", 'abcA3l2', '==']) + + call setreg('B', ["\n", 'abcB3c2'], 'c') + call Assert_reg('B', "v", "abcB3\nabcB3l\nabcB3c\n\n\nabcB3c2", "['abcB3', 'abcB3l', 'abcB3c', '\n', 'abcB3c2']", "abcB3\nabcB3l\nabcB3c\n\n\nabcB3c2", "['abcB3', 'abcB3l', 'abcB3c', '\n', 'abcB3c2']") + call Assert_regput('B', ['==', '=abcB3', 'abcB3l', 'abcB3c', "\n", 'abcB3c2=']) + + call setreg('C', ["\n", 'abcC3b2'], 'b') + call Assert_reg('C', "7", "abcC3\nabcC3b\nabcC3l\n\n\nabcC3b2", "['abcC3', 'abcC3b', 'abcC3l', '\n', 'abcC3b2']", "abcC3\nabcC3b\nabcC3l\n\n\nabcC3b2", "['abcC3', 'abcC3b', 'abcC3l', '\n', 'abcC3b2']") + call Assert_regput('C', ['==', '=abcC3 =', ' abcC3b', ' abcC3l', " \n", ' abcC3b2']) + + call setreg('D', ["\n", 'abcD3b50'],'b50') + call Assert_reg('D', "50", "abcD3\nabcD32\nabcD3b\n\n\nabcD3b50", "['abcD3', 'abcD32', 'abcD3b', '\n', 'abcD3b50']", "abcD3\nabcD32\nabcD3b\n\n\nabcD3b50", "['abcD3', 'abcD32', 'abcD3b', '\n', 'abcD3b50']") + call Assert_regput('D', ['==', '=abcD3 =', ' abcD32', ' abcD3b', " \n", ' abcD3b50']) + + " Setting lists with NLs with setreg() + call setreg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"]) + call Assert_reg('a', "V", "abcA4-0\n\n\nabcA4-2\n\n\nabcA4-3\nabcA4-4\nabcA4-4-2\n", "['abcA4-0', '\n', 'abcA4-2\n', '\nabcA4-3', 'abcA4-4\nabcA4-4-2']", "abcA4-0\n\n\nabcA4-2\n\n\nabcA4-3\nabcA4-4\nabcA4-4-2\n", "['abcA4-0', '\n', 'abcA4-2\n', '\nabcA4-3', 'abcA4-4\nabcA4-4-2']") + call Assert_regput('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 Assert_reg('b', "v", "abcB4c-0\n\n\nabcB4c-2\n\n\nabcB4c-3\nabcB4c-4\nabcB4c-4-2", "['abcB4c-0', '\n', 'abcB4c-2\n', '\nabcB4c-3', 'abcB4c-4\nabcB4c-4-2']", "abcB4c-0\n\n\nabcB4c-2\n\n\nabcB4c-3\nabcB4c-4\nabcB4c-4-2", "['abcB4c-0', '\n', 'abcB4c-2\n', '\nabcB4c-3', 'abcB4c-4\nabcB4c-4-2']") + call Assert_regput('b', ['==', '=abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2="]) + + call setreg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l') + call Assert_reg('c', "V", "abcC4l-0\n\n\nabcC4l-2\n\n\nabcC4l-3\nabcC4l-4\nabcC4l-4-2\n", "['abcC4l-0', '\n', 'abcC4l-2\n', '\nabcC4l-3', 'abcC4l-4\nabcC4l-4-2']", "abcC4l-0\n\n\nabcC4l-2\n\n\nabcC4l-3\nabcC4l-4\nabcC4l-4-2\n", "['abcC4l-0', '\n', 'abcC4l-2\n', '\nabcC4l-3', 'abcC4l-4\nabcC4l-4-2']") + call Assert_regput('c', ['==', 'abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2", '==']) + + call setreg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b') + call Assert_reg('d', "19", "abcD4b-0\n\n\nabcD4b-2\n\n\nabcD4b-3\nabcD4b-4\nabcD4b-4-2", "['abcD4b-0', '\n', 'abcD4b-2\n', '\nabcD4b-3', 'abcD4b-4\nabcD4b-4-2']", "abcD4b-0\n\n\nabcD4b-2\n\n\nabcD4b-3\nabcD4b-4\nabcD4b-4-2", "['abcD4b-0', '\n', 'abcD4b-2\n', '\nabcD4b-3', 'abcD4b-4\nabcD4b-4-2']") + call Assert_regput('d', ['==', '=abcD4b-0 =', " \n", " abcD4b-2\n", " \nabcD4b-3", " abcD4b-4\nabcD4b-4-2"]) + + call setreg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10') + call Assert_reg('e', "10", "abcE4b10-0\n\n\nabcE4b10-2\n\n\nabcE4b10-3\nabcE4b10-4\nabcE4b10-4-2", "['abcE4b10-0', '\n', 'abcE4b10-2\n', '\nabcE4b10-3', 'abcE4b10-4\nabcE4b10-4-2']", "abcE4b10-0\n\n\nabcE4b10-2\n\n\nabcE4b10-3\nabcE4b10-4\nabcE4b10-4-2", "['abcE4b10-0', '\n', 'abcE4b10-2\n', '\nabcE4b10-3', 'abcE4b10-4\nabcE4b10-4-2']") + call Assert_regput('e', ['==', '=abcE4b10-0=', " \n", " abcE4b10-2\n", " \nabcE4b10-3", " abcE4b10-4\nabcE4b10-4-2"]) + + " Search and expressions + call setreg('/', ['abc/']) + call Assert_reg('/', 'v', "abc/", "['abc/']", "abc/", "['abc/']") + call Assert_regput('/', ['==', '=abc/=']) + + call setreg('/', ["abc/\n"]) + call Assert_reg('/', 'v', "abc/\n", "['abc/\n']", "abc/\n", "['abc/\n']") + call Assert_regput('/', ['==', "=abc/\n="]) + + call setreg('=', ['"abc/"']) + call Assert_reg('=', 'v', "abc/", "['abc/']", '"abc/"', "['\"abc/\"']") + + call setreg('=', ["\"abc/\n\""]) + call Assert_reg('=', 'v', "abc/\n", "['abc/\n']", "\"abc/\n\"", "['\"abc/\n\"']") + + " System clipboard + if has('clipboard') + new | only! + call setline(1, ['clipboard contents', 'something else']) + " 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' + 1y + call Assert_reg('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']") + tabdo :windo :echo "hi" + 2y + call Assert_reg('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']") + let &cb=_clipopt + call call('setreg', _clipreg) + enew! + endif + " Error cases call assert_fails('call setreg()', 'E119:') call assert_fails('call setreg(1)', 'E119:') diff --git a/src/version.c b/src/version.c index ad2e1c3d76..0946468501 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 661, +/**/ 660, /**/ 659, |