To: vim_dev@googlegroups.com Subject: Patch 8.0.0890 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0890 Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan) Files: src/testdir/Make_all.mak, src/testdir/Make_vms.mms, src/testdir/test103.in, src/testdir/test103.ok, src/testdir/test107.in, src/testdir/test107.ok, src/testdir/test51.in, src/testdir/test51.ok, src/testdir/test91.in, src/testdir/test91.ok, src/testdir/test_getvar.vim, src/testdir/test_highlight.vim, src/testdir/test_visual.vim, src/testdir/test_window_cmd.vim, src/Makefile *** ../vim-8.0.0889/src/testdir/Make_all.mak 2017-08-04 22:36:01.562927288 +0200 --- src/testdir/Make_all.mak 2017-08-07 21:53:34.471401833 +0200 *************** *** 38,44 **** test44.out \ test45.out \ test48.out \ - test51.out \ test53.out \ test55.out \ test56.out \ --- 38,43 ---- *************** *** 53,64 **** test79.out \ test80.out \ test88.out \ - test91.out \ test94.out \ test95.out \ test99.out \ - test103.out \ - test107.out \ test108.out \ test_autoformat_join.out \ test_changelist.out \ --- 52,60 ---- *************** *** 140,145 **** --- 136,142 ---- test_file_size.res \ test_fnameescape.res \ test_fold.res \ + test_getvar.res \ test_gf.res \ test_gn.res \ test_gui.res \ *************** *** 147,152 **** --- 144,150 ---- test_hardcopy.res \ test_help.res \ test_hide.res \ + test_highlight.res \ test_history.res \ test_hlsearch.res \ test_increment.res \ *** ../vim-8.0.0889/src/testdir/Make_vms.mms 2017-08-04 22:36:01.562927288 +0200 --- src/testdir/Make_vms.mms 2017-08-07 21:53:34.471401833 +0200 *************** *** 81,97 **** test33.out test34.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out \ ! test48.out test49.out test51.out test53.out test54.out \ test55.out test56.out test57.out test60.out \ test64.out \ test66.out test68.out test69.out \ test72.out \ test77a.out test78.out test79.out test80.out \ test88.out \ ! test91.out test94.out \ test95.out test99.out \ ! test103.out \ ! test107.out test108.out\ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ --- 81,96 ---- test33.out test34.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out \ ! test48.out test49.out test53.out test54.out \ test55.out test56.out test57.out test60.out \ test64.out \ test66.out test68.out test69.out \ test72.out \ test77a.out test78.out test79.out test80.out \ test88.out \ ! test94.out \ test95.out test99.out \ ! test108.out\ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ *** ../vim-8.0.0889/src/testdir/test103.in 2017-03-08 22:55:14.910181250 +0100 --- src/testdir/test103.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,38 **** - Test for visual mode not being reset causing E315 error. - STARTTEST - :so small.vim - :set belloff=all - :enew - :let g:msg="Everything's fine." - :function! TriggerTheProblem() - : " At this point there is no visual selection because :call reset it. - : " Let's restore the selection: - : normal gv - : '<,'>del _ - : try - : exe "normal \" - : catch /^Vim\%((\a\+)\)\=:E315/ - : echom 'Snap! E315 error!' - : let g:msg='Snap! E315 error!' - : endtry - :endfunction - :enew - :setl buftype=nofile - :call append(line('$'), 'Delete this line.') - :" - :" - :" NOTE: this has to be done by a call to a function because executing :del the - :" ex-way will require the colon operator which resets the visual mode thus - :" preventing the problem: - :" - GV:call TriggerTheProblem() - :%del _ - :call append(line('$'), g:msg) - :w! test.out - :brewind - ENDTEST - - STARTTEST - :qa! - ENDTEST - --- 0 ---- *** ../vim-8.0.0889/src/testdir/test103.ok 2013-11-21 14:02:28.000000000 +0100 --- src/testdir/test103.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,2 **** - - Everything's fine. --- 0 ---- *** ../vim-8.0.0889/src/testdir/test107.in 2015-12-05 18:35:07.000000000 +0100 --- src/testdir/test107.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,38 **** - Tests for adjusting window and contents vim: set ft=vim : - - STARTTEST - :so small.vim - :new - :call setline(1, range(1,256)) - :let r=[] - :func! GetScreenStr(row) - : let str = "" - : for c in range(1,3) - : let str .= nr2char(screenchar(a:row, c)) - : endfor - : return str - :endfunc - : - :exe ":norm! \t\=1Gzt\w\+" - :let s3=GetScreenStr(1) - :wincmd p - :call add(r, [line("w0"), s3]) - : - :exe ":norm! \t\=50Gzt\w\+" - :let s3=GetScreenStr(1) - :wincmd p - :call add(r, [line("w0"), s3]) - : - :exe ":norm! \t\=59Gzt\w\+" - :let s3=GetScreenStr(1) - ::wincmd p - :call add(r, [line("w0"), s3]) - : - :bwipeout! - :$put=r - :call garbagecollect(1) - :" - :/^start:/,$wq! test.out - ENDTEST - - start: --- 0 ---- *** ../vim-8.0.0889/src/testdir/test107.ok 2014-05-29 11:40:20.000000000 +0200 --- src/testdir/test107.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,4 **** - start: - [1, '1 '] - [50, '50 '] - [59, '59 '] --- 0 ---- *** ../vim-8.0.0889/src/testdir/test51.in 2016-10-12 17:52:39.195701853 +0200 --- src/testdir/test51.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,36 **** - Tests for ":highlight". vim: set ft=vim : - - STARTTEST - :so small.vim - :" basic test if ":highlight" doesn't crash - :highlight - :hi Search - :" test setting colors. - :" test clearing one color and all doesn't generate error or warning - :hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan - :hi Group2 term= cterm= - :hi Group3 term=underline cterm=bold - :redir! >test.out - :hi NewGroup - :hi Group2 - :hi Group3 - :hi clear NewGroup - :hi NewGroup - :hi Group2 - :hi Group2 NONE - :hi Group2 - :hi clear - :hi Group3 - :hi Crash term='asdf - :redir END - :" filter ctermfg and ctermbg, the numbers depend on the terminal - :e! test.out - :%s/ctermfg=\d*/ctermfg=2/ - :%s/ctermbg=\d*/ctermbg=3/ - :" filter out possibly translated error message - :%s/E475: [^:]*:/E475:/ - :" fix the fileformat - :set ff& - :wq! - ENDTEST - --- 0 ---- *** ../vim-8.0.0889/src/testdir/test51.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test51.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,20 **** - - - NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3 - - Group2 xxx cleared - - Group3 xxx term=underline cterm=bold - - - NewGroup xxx cleared - - Group2 xxx cleared - - - Group2 xxx cleared - - - Group3 xxx cleared - - E475: term='asdf --- 0 ---- *** ../vim-8.0.0889/src/testdir/test91.in 2017-02-17 16:31:16.929294079 +0100 --- src/testdir/test91.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,89 **** - Tests for getwinvar(), gettabvar() and gettabwinvar(). - vim: set ft=vim : - - STARTTEST - :so small.vim - :so mbyte.vim - :" - :" Use strings to test for memory leaks. - :" First, check that in an empty window, gettabvar() returns the correct value - :let t:testvar='abcd' - :$put =string(gettabvar(1,'testvar')) - :$put =string(gettabvar(1,'testvar')) - :" - :" test for getwinvar() - :let w:var_str = "Dance" - :let def_str = "Chance" - :$put =string(getwinvar(1, 'var_str')) - :$put =string(getwinvar(1, 'var_str', def_str)) - :$put =string(getwinvar(1, '')) - :$put =string(getwinvar(1, '', def_str)) - :unlet w:var_str - :$put =string(getwinvar(1, 'var_str', def_str)) - :$put =string(getwinvar(1, '')) - :$put =string(getwinvar(1, '', def_str)) - :$put =string(getwinvar(9, '')) - :$put =string(getwinvar(9, '', def_str)) - :$put =string(getwinvar(1, '&nu')) - :$put =string(getwinvar(1, '&nu', 1)) - :unlet def_str - :" - :" test for gettabvar() - :tabnew - :tabnew - :let t:var_list = [1, 2, 3] - :let t:other = 777 - :let def_list = [4, 5, 6, 7] - :tabrewind - :$put =string(gettabvar(3, 'var_list')) - :$put =string(gettabvar(3, 'var_list', def_list)) - :$put =string(gettabvar(3, '')) - :$put =string(gettabvar(3, '', def_list)) - :tablast - :unlet t:var_list - :tabrewind - :$put =string(gettabvar(3, 'var_list', def_list)) - :$put =string(gettabvar(9, '')) - :$put =string(gettabvar(9, '', def_list)) - :$put =string(gettabvar(3, '&nu')) - :$put =string(gettabvar(3, '&nu', def_list)) - :unlet def_list - :tabonly - :" - :" test for gettabwinvar() - :tabnew - :tabnew - :tabprev - :split - :split - :wincmd w - :vert split - :wincmd w - :let w:var_dict = {'dict': 'tabwin'} - :let def_dict = {'dict2': 'newval'} - :wincmd b - :tabrewind - :$put =string(gettabwinvar(2, 3, 'var_dict')) - :$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) - :$put =string(gettabwinvar(2, 3, '')) - :$put =string(gettabwinvar(2, 3, '', def_dict)) - :tabnext - :3wincmd w - :unlet w:var_dict - :tabrewind - :$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) - :$put =string(gettabwinvar(2, 3, '')) - :$put =string(gettabwinvar(2, 3, '', def_dict)) - :$put =string(gettabwinvar(2, 9, '')) - :$put =string(gettabwinvar(2, 9, '', def_dict)) - :$put =string(gettabwinvar(9, 3, '')) - :$put =string(gettabwinvar(9, 3, '', def_dict)) - :unlet def_dict - :$put =string(gettabwinvar(2, 3, '&nux')) - :$put =string(gettabwinvar(2, 3, '&nux', 1)) - :tabonly - :" - :/^start/,$wq! test.out - ENDTEST - - start: --- 0 ---- *** ../vim-8.0.0889/src/testdir/test91.ok 2017-02-17 16:31:16.929294079 +0100 --- src/testdir/test91.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,36 **** - start: - 'abcd' - 'abcd' - 'Dance' - 'Dance' - {'var_str': 'Dance'} - {'var_str': 'Dance'} - 'Chance' - {} - {} - '' - 'Chance' - 0 - 0 - [1, 2, 3] - [1, 2, 3] - {'var_list': [1, 2, 3], 'other': 777} - {'var_list': [1, 2, 3], 'other': 777} - [4, 5, 6, 7] - '' - [4, 5, 6, 7] - '' - [4, 5, 6, 7] - {'dict': 'tabwin'} - {'dict': 'tabwin'} - {'var_dict': {'dict': 'tabwin'}} - {'var_dict': {'dict': 'tabwin'}} - {'dict2': 'newval'} - {} - {} - '' - {'dict2': 'newval'} - '' - {'dict2': 'newval'} - '' - 1 --- 0 ---- *** ../vim-8.0.0889/src/testdir/test_getvar.vim 2017-08-07 22:01:36.827862942 +0200 --- src/testdir/test_getvar.vim 2017-08-07 21:53:34.475401803 +0200 *************** *** 0 **** --- 1,88 ---- + " Tests for getwinvar(), gettabvar() and gettabwinvar(). + func Test_var() + " Use strings to test for memory leaks. First, check that in an empty + " window, gettabvar() returns the correct value + let t:testvar='abcd' + call assert_equal('abcd', gettabvar(1, 'testvar')) + call assert_equal('abcd', gettabvar(1, 'testvar')) + + " test for getwinvar() + let w:var_str = "Dance" + let def_str = "Chance" + call assert_equal('Dance', getwinvar(1, 'var_str')) + call assert_equal('Dance', getwinvar(1, 'var_str', def_str)) + call assert_equal({'var_str': 'Dance'}, getwinvar(1, '')) + call assert_equal({'var_str': 'Dance'}, getwinvar(1, '', def_str)) + unlet w:var_str + call assert_equal('Chance', getwinvar(1, 'var_str', def_str)) + call assert_equal({}, getwinvar(1, '')) + call assert_equal({}, getwinvar(1, '', def_str)) + call assert_equal('', getwinvar(9, '')) + call assert_equal('Chance', getwinvar(9, '', def_str)) + call assert_equal(0, getwinvar(1, '&nu')) + call assert_equal(0, getwinvar(1, '&nu', 1)) + unlet def_str + + " test for gettabvar() + tabnew + tabnew + let t:var_list = [1, 2, 3] + let t:other = 777 + let def_list = [4, 5, 6, 7] + tabrewind + call assert_equal([1, 2, 3], gettabvar(3, 'var_list')) + call assert_equal([1, 2, 3], gettabvar(3, 'var_list', def_list)) + call assert_equal({'var_list': [1, 2, 3], 'other': 777}, gettabvar(3, '')) + call assert_equal({'var_list': [1, 2, 3], 'other': 777}, + \ gettabvar(3, '', def_list)) + + tablast + unlet t:var_list + tabrewind + call assert_equal([4, 5, 6, 7], gettabvar(3, 'var_list', def_list)) + call assert_equal('', gettabvar(9, '')) + call assert_equal([4, 5, 6, 7], gettabvar(9, '', def_list)) + call assert_equal('', gettabvar(3, '&nu')) + call assert_equal([4, 5, 6, 7], gettabvar(3, '&nu', def_list)) + unlet def_list + tabonly + + " test for gettabwinvar() + tabnew + tabnew + tabprev + split + split + wincmd w + vert split + wincmd w + let w:var_dict = {'dict': 'tabwin'} + let def_dict = {'dict2': 'newval'} + wincmd b + tabrewind + call assert_equal({'dict': 'tabwin'}, gettabwinvar(2, 3, 'var_dict')) + call assert_equal({'dict': 'tabwin'}, + \ gettabwinvar(2, 3, 'var_dict', def_dict)) + call assert_equal({'var_dict': {'dict': 'tabwin'}}, gettabwinvar(2, 3, '')) + call assert_equal({'var_dict': {'dict': 'tabwin'}}, + \ gettabwinvar(2, 3, '', def_dict)) + + tabnext + 3wincmd w + unlet w:var_dict + tabrewind + call assert_equal({'dict2': 'newval'}, + \ gettabwinvar(2, 3, 'var_dict', def_dict)) + call assert_equal({}, gettabwinvar(2, 3, '')) + call assert_equal({}, gettabwinvar(2, 3, '', def_dict)) + call assert_equal("", gettabwinvar(2, 9, '')) + call assert_equal({'dict2': 'newval'}, gettabwinvar(2, 9, '', def_dict)) + call assert_equal('', gettabwinvar(9, 3, '')) + call assert_equal({'dict2': 'newval'}, gettabwinvar(9, 3, '', def_dict)) + + unlet def_dict + + call assert_equal('', gettabwinvar(2, 3, '&nux')) + call assert_equal(1, gettabwinvar(2, 3, '&nux', 1)) + tabonly + endfunc *** ../vim-8.0.0889/src/testdir/test_highlight.vim 2017-08-07 22:01:36.831862913 +0200 --- src/testdir/test_highlight.vim 2017-08-07 21:56:50.437963874 +0200 *************** *** 0 **** --- 1,36 ---- + " Tests for ":highlight". + func Test_highlight() + " basic test if ":highlight" doesn't crash + highlight + hi Search + + " test setting colors. + " test clearing one color and all doesn't generate error or warning + silent! hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan + silent! hi Group2 term= cterm= + hi Group3 term=underline cterm=bold + + let res = split(execute("hi NewGroup"), "\n")[0] + " filter ctermfg and ctermbg, the numbers depend on the terminal + let res = substitute(res, 'ctermfg=\d*', 'ctermfg=2', '') + let res = substitute(res, 'ctermbg=\d*', 'ctermbg=3', '') + call assert_equal("NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3", + \ res) + call assert_equal("Group2 xxx cleared", + \ split(execute("hi Group2"), "\n")[0]) + call assert_equal("Group3 xxx term=underline cterm=bold", + \ split(execute("hi Group3"), "\n")[0]) + + hi clear NewGroup + call assert_equal("NewGroup xxx cleared", + \ split(execute("hi NewGroup"), "\n")[0]) + call assert_equal("Group2 xxx cleared", + \ split(execute("hi Group2"), "\n")[0]) + hi Group2 NONE + call assert_equal("Group2 xxx cleared", + \ split(execute("hi Group2"), "\n")[0]) + hi clear + call assert_equal("Group3 xxx cleared", + \ split(execute("hi Group3"), "\n")[0]) + call assert_fails("hi Crash term='asdf", "E475:") + endfunc *** ../vim-8.0.0889/src/testdir/test_visual.vim 2017-08-06 15:42:01.640570872 +0200 --- src/testdir/test_visual.vim 2017-08-07 21:57:48.081540956 +0200 *************** *** 60,62 **** --- 60,93 ---- normal vki' bwipe! endfunc + + " Test for Visual mode not being reset causing E315 error. + func TriggerTheProblem() + " At this point there is no visual selection because :call reset it. + " Let's restore the selection: + normal gv + '<,'>del _ + try + exe "normal \" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg='Snap! E315 error!' + endtry + endfunc + + func Test_visual_mode_reset() + set belloff=all + enew + let g:msg="Everything's fine." + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + + " NOTE: this has to be done by a call to a function because executing :del + " the ex-way will require the colon operator which resets the visual mode + " thus preventing the problem: + exe "normal! GV:call TriggerTheProblem()\" + call assert_equal("Everything's fine.", g:msg) + + set belloff& + endfunc *** ../vim-8.0.0889/src/testdir/test_window_cmd.vim 2017-06-25 22:45:34.846414408 +0200 --- src/testdir/test_window_cmd.vim 2017-08-07 21:58:25.781264376 +0200 *************** *** 416,419 **** --- 416,457 ---- bwipe! endfunc + " Tests for adjusting window and contents + func GetScreenStr(row) + let str = "" + for c in range(1,3) + let str .= nr2char(screenchar(a:row, c)) + endfor + return str + endfunc + + func Test_window_contents() + enew! | only | new + call setline(1, range(1,256)) + + exe "norm! \t\=1Gzt\w\+" + redraw + let s3=GetScreenStr(1) + wincmd p + call assert_equal(1, line("w0")) + call assert_equal('1 ', s3) + + exe "norm! \t\=50Gzt\w\+" + redraw + let s3=GetScreenStr(1) + wincmd p + call assert_equal(50, line("w0")) + call assert_equal('50 ', s3) + + exe "norm! \t\=59Gzt\w\+" + redraw + let s3=GetScreenStr(1) + wincmd p + call assert_equal(59, line("w0")) + call assert_equal('59 ', s3) + + bwipeout! + call test_garbagecollect_now() + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.0.0889/src/Makefile 2017-08-04 22:36:01.566927258 +0200 --- src/Makefile 2017-08-07 21:55:20.610622969 +0200 *************** *** 2169,2174 **** --- 2169,2175 ---- test_functions \ test_ga \ test_getcwd \ + test_getvar \ test_gf \ test_glob2regpat \ test_global \ *************** *** 2180,2185 **** --- 2181,2187 ---- test_help \ test_help_tagjump \ test_hide \ + test_highlight \ test_history \ test_hlsearch \ test_increment \ *** ../vim-8.0.0889/src/version.c 2017-08-07 21:26:24.215375332 +0200 --- src/version.c 2017-08-07 22:01:07.640077033 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 890, /**/ -- ARTHUR: But if he was dying, he wouldn't bother to carve "Aaaaarrrrrrggghhh". He'd just say it. BROTHER MAYNARD: It's down there carved in stone. GALAHAD: Perhaps he was dictating. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///