Mercurial > vim
changeset 20211:3a94b984c9f9 v8.2.0661
patch 8.2.0661: eval test is still old style
Commit: https://github.com/vim/vim/commit/339d60c89bef0315343a6128a1b4826510b0efe4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 29 22:01:21 2020 +0200
patch 8.2.0661: eval test is still old style
Problem: Eval test is still old style.
Solution: Change into new style tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6009)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 29 Apr 2020 22:15:04 +0200 |
parents | 94eacaea0709 |
children | 234d86d5f2d0 |
files | src/Makefile src/testdir/Make_all.mak src/testdir/Make_vms.mms src/testdir/test_eval.in src/testdir/test_eval.ok src/testdir/test_eval_stuff.vim src/version.c |
diffstat | 7 files changed, 169 insertions(+), 127 deletions(-) [+] |
line wrap: on
line diff
--- 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 \
--- 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 = \
--- 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: #
deleted file mode 100644 --- 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:
deleted file mode 100644 index 3ae6f6c67184852ca66d7e73d7a9552d12de5bca..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@<O00001
--- 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:')