From 5706ff15ed524fb88bc1cc463597550b895b0d7a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 29 Nov 2020 20:50:57 -0500 Subject: [PATCH 1/4] vim-patch:8.2.2069: the quickfix window is not updated after setqflist() Problem: The quickfix window is not updated after setqflist(). Solution: Update the quickfix buffer. (Yegappan Lakshmanan, closes vim/vim#7390, closes vim/vim#7385) https://github.com/vim/vim/commit/287153c5d481a09ffe98a95ad78390ff580bb557 N/A patches for version.c: vim-patch:8.2.2067: cursor position in popup terminal is wrong Problem: Cursor position in popup terminal is wrong. Solution: Don't check the flags. https://github.com/vim/vim/commit/f5452691ba30e33b38c5b06c51ba40b58457d5d8 --- src/nvim/quickfix.c | 7 ++-- src/nvim/testdir/test_quickfix.vim | 58 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 3d7d587ed2..7fdc998e20 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -6155,7 +6155,7 @@ static int qf_setprop_items_from_lines( qf_free_items(&qi->qf_lists[qf_idx]); } if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat, - false, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) { + false, (linenr_T)0, (linenr_T)0, NULL, NULL) >= 0) { retval = OK; } @@ -6256,9 +6256,12 @@ static int qf_set_properties(qf_info_T *qi, const dict_T *what, int action, retval = qf_setprop_curidx(qi, qfl, di); } - if (retval == OK) { + if (newlist || retval == OK) { qf_list_changed(qfl); } + if (newlist) { + qf_update_buffer(qi, NULL); + } return retval; } diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 5c84e45a79..e06c4f59da 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -4485,4 +4485,62 @@ func Test_quickfix_window_fails_to_open() call delete('XquickfixFails') endfunc +" Test for updating the quickfix buffer whenever the assocaited quickfix list +" is changed. +func Xqfbuf_update(cchar) + call s:setup_commands(a:cchar) + + Xexpr "F1:1:line1" + Xopen + call assert_equal(['F1|1| line1'], getline(1, '$')) + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + + " Test setqflist() using the 'lines' key in 'what' + " add a new entry + call g:Xsetlist([], 'a', {'lines' : ['F2:2: line2']}) + call assert_equal(['F1|1| line1', 'F2|2| line2'], getline(1, '$')) + call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick) + " replace all the entries with a single entry + call g:Xsetlist([], 'r', {'lines' : ['F3:3: line3']}) + call assert_equal(['F3|3| line3'], getline(1, '$')) + call assert_equal(3, g:Xgetlist({'changedtick' : 0}).changedtick) + " remove all the entries + call g:Xsetlist([], 'r', {'lines' : []}) + call assert_equal([''], getline(1, '$')) + call assert_equal(4, g:Xgetlist({'changedtick' : 0}).changedtick) + " add a new list + call g:Xsetlist([], ' ', {'lines' : ['F4:4: line4']}) + call assert_equal(['F4|4| line4'], getline(1, '$')) + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + + " Test setqflist() using the 'items' key in 'what' + " add a new entry + call g:Xsetlist([], 'a', {'items' : [{'filename' : 'F5', 'lnum' : 5, 'text' : 'line5'}]}) + call assert_equal(['F4|4| line4', 'F5|5| line5'], getline(1, '$')) + call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick) + " replace all the entries with a single entry + call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F6', 'lnum' : 6, 'text' : 'line6'}]}) + call assert_equal(['F6|6| line6'], getline(1, '$')) + call assert_equal(3, g:Xgetlist({'changedtick' : 0}).changedtick) + " remove all the entries + call g:Xsetlist([], 'r', {'items' : []}) + call assert_equal([''], getline(1, '$')) + call assert_equal(4, g:Xgetlist({'changedtick' : 0}).changedtick) + " add a new list + call g:Xsetlist([], ' ', {'items' : [{'filename' : 'F7', 'lnum' : 7, 'text' : 'line7'}]}) + call assert_equal(['F7|7| line7'], getline(1, '$')) + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + + call g:Xsetlist([], ' ', {}) + call assert_equal([''], getline(1, '$')) + call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) + + Xclose +endfunc + +func Test_qfbuf_update() + call Xqfbuf_update('c') + call Xqfbuf_update('l') +endfunc + " vim: shiftwidth=2 sts=2 expandtab From b3ddc23507c391c776614a8dc8139939c711dee4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 30 Nov 2020 01:08:27 -0500 Subject: [PATCH 2/4] test/old: partial port of patch 8.1.0711 Patch 8.1.0711 is too difficult to merge in 1 commit. --- src/nvim/testdir/test49.vim | 10 +- src/nvim/testdir/test_autocmd.vim | 2 +- src/nvim/testdir/test_charsearch.vim | 8 +- src/nvim/testdir/test_charsearch_utf8.vim | 2 +- src/nvim/testdir/test_edit.vim | 74 +++---- src/nvim/testdir/test_fnameescape.vim | 4 +- src/nvim/testdir/test_getcwd.vim | 188 +++++++++--------- src/nvim/testdir/test_highlight.vim | 16 +- src/nvim/testdir/test_hlsearch.vim | 4 +- src/nvim/testdir/test_listlbr.vim | 4 +- src/nvim/testdir/test_listlbr_utf8.vim | 20 +- src/nvim/testdir/test_matchadd_conceal.vim | 32 +-- .../testdir/test_matchadd_conceal_utf8.vim | 2 +- src/nvim/testdir/test_number.vim | 10 +- src/nvim/testdir/test_options.vim | 2 +- src/nvim/testdir/test_partial.vim | 8 +- src/nvim/testdir/test_smartindent.vim | 18 +- src/nvim/testdir/test_substitute.vim | 10 +- src/nvim/testdir/test_textobjects.vim | 2 +- src/nvim/testdir/test_utf8.vim | 12 +- src/nvim/testdir/test_utf8_comparisons.vim | 26 +-- src/nvim/testdir/test_vimscript.vim | 104 +++++----- 22 files changed, 279 insertions(+), 279 deletions(-) diff --git a/src/nvim/testdir/test49.vim b/src/nvim/testdir/test49.vim index c86fdf25ab..103b282bc7 100644 --- a/src/nvim/testdir/test49.vim +++ b/src/nvim/testdir/test49.vim @@ -318,7 +318,7 @@ let ExtraVimCount = 0 let ExtraVimBase = expand("") let ExtraVimTestEnv = "" " -function! ExtraVim(...) +function ExtraVim(...) " Count how often this function is called. let g:ExtraVimCount = g:ExtraVimCount + 1 @@ -500,7 +500,7 @@ endfunction " an ExtraVim script as passed by ExtraVim() in ExtraVimBegin. " " EXTRA_VIM_START - do not change or remove this line. -function! ExtraVimThrowpoint() +function ExtraVimThrowpoint() if !exists("g:ExtraVimBegin") Xout "ExtraVimThrowpoint() used outside ExtraVim() script." return v:throwpoint @@ -530,7 +530,7 @@ endfunction " as a script file, use ExecAsScript below. " " EXTRA_VIM_START - do not change or remove this line. -function! MakeScript(funcname, ...) +function MakeScript(funcname, ...) let script = tempname() execute "redir! >" . script execute "function" a:funcname @@ -568,7 +568,7 @@ endfunction " location specified in the function. " " EXTRA_VIM_START - do not change or remove this line. -function! ExecAsScript(funcname) +function ExecAsScript(funcname) " Make a script from the function passed as argument. let script = MakeScript(a:funcname) @@ -8548,7 +8548,7 @@ endfunction " Remove the autocommands for the events specified as arguments in all used " autogroups. -function! Delete_autocommands(...) +function Delete_autocommands(...) let augfile = tempname() while 1 try diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 1fa7eeaea0..641e98ab30 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1359,7 +1359,7 @@ func Test_ChangedP() endfunc let g:setline_handled = v:false -func! SetLineOne() +func SetLineOne() if !g:setline_handled call setline(1, "(x)") let g:setline_handled = v:true diff --git a/src/nvim/testdir/test_charsearch.vim b/src/nvim/testdir/test_charsearch.vim index 8b313b5a35..17a49e02be 100644 --- a/src/nvim/testdir/test_charsearch.vim +++ b/src/nvim/testdir/test_charsearch.vim @@ -1,5 +1,5 @@ -function! Test_charsearch() +func Test_charsearch() enew! call append(0, ['Xabcdefghijkemnopqretuvwxyz', \ 'Yabcdefghijkemnopqretuvwxyz', @@ -29,10 +29,10 @@ function! Test_charsearch() normal! ;;p call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3)) enew! -endfunction +endfunc " Test for t,f,F,T movement commands and 'cpo-;' setting -function! Test_search_cmds() +func Test_search_cmds() enew! call append(0, ["aaa two three four", " zzz", "yyy ", \ "bbb yee yoo four", "ccc two three four", @@ -59,4 +59,4 @@ function! Test_search_cmds() call assert_equal('ccc', getline(5)) call assert_equal('ddd yee y', getline(6)) enew! -endfunction +endfunc diff --git a/src/nvim/testdir/test_charsearch_utf8.vim b/src/nvim/testdir/test_charsearch_utf8.vim index eac5d46ad8..09341a90b0 100644 --- a/src/nvim/testdir/test_charsearch_utf8.vim +++ b/src/nvim/testdir/test_charsearch_utf8.vim @@ -14,6 +14,6 @@ function! Test_search_cmds() normal! , call assert_equal([0, 1, 28, 0], getpos('.')) bw! -endfunction +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index abad6983dc..e1393e875b 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -11,7 +11,7 @@ source view_util.vim " Needs to come first until the bug in getchar() is " fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ -func! Test_edit_00b() +func Test_edit_00b() new call setline(1, ['abc ']) inoreabbr h here some more @@ -23,7 +23,7 @@ func! Test_edit_00b() bw! endfunc -func! Test_edit_01() +func Test_edit_01() " set for Travis CI? " set nocp noesckeys new @@ -61,7 +61,7 @@ func! Test_edit_01() bw! endfunc -func! Test_edit_02() +func Test_edit_02() " Change cursor position in InsertCharPre command new call setline(1, 'abc') @@ -101,7 +101,7 @@ func! Test_edit_02() bw! endfunc -func! Test_edit_03() +func Test_edit_03() " Change cursor after command to end of line new call setline(1, 'abc') @@ -120,7 +120,7 @@ func! Test_edit_03() bw! endfunc -func! Test_edit_04() +func Test_edit_04() " test for :stopinsert new call setline(1, 'abc') @@ -132,7 +132,7 @@ func! Test_edit_04() bw! endfunc -func! Test_edit_05() +func Test_edit_05() " test for folds being opened new call setline(1, ['abcX', 'abcX', 'zzzZ']) @@ -154,7 +154,7 @@ func! Test_edit_05() bw! endfunc -func! Test_edit_06() +func Test_edit_06() " Test in diff mode if !has("diff") || !executable("diff") return @@ -176,7 +176,7 @@ func! Test_edit_06() bw! endfunc -func! Test_edit_07() +func Test_edit_07() " 1) Test with completion when popupmenu is visible new call setline(1, 'J') @@ -228,7 +228,7 @@ func! Test_edit_08() unlet g:bufnr endfunc -func! Test_edit_09() +func Test_edit_09() " test i_CTRL-\ combinations new call setline(1, ['abc', 'def', 'ghi']) @@ -258,7 +258,7 @@ func! Test_edit_09() bw! endfunc -func! Test_edit_10() +func Test_edit_10() " Test for starting selectmode new set selectmode=key keymodel=startsel @@ -270,7 +270,7 @@ func! Test_edit_10() bw! endfunc -func! Test_edit_11() +func Test_edit_11() " Test that indenting kicks in new set cindent @@ -314,7 +314,7 @@ func! Test_edit_11() bw! endfunc -func! Test_edit_11_indentexpr() +func Test_edit_11_indentexpr() " Test that indenting kicks in new " Use indentexpr instead of cindenting @@ -341,7 +341,7 @@ func! Test_edit_11_indentexpr() bw! endfunc -func! Test_edit_12() +func Test_edit_12() " Test changing indent in replace mode new call setline(1, ["\tabc", "\tdef"]) @@ -393,7 +393,7 @@ func! Test_edit_12() bw! endfunc -func! Test_edit_13() +func Test_edit_13() " Test smartindenting if exists("+smartindent") new @@ -481,7 +481,7 @@ func! Test_edit_CTRL_() endfunc " needs to come first, to have the @. register empty -func! Test_edit_00a_CTRL_A() +func Test_edit_00a_CTRL_A() " Test pressing CTRL-A new call setline(1, repeat([''], 5)) @@ -501,7 +501,7 @@ func! Test_edit_00a_CTRL_A() bw! endfunc -func! Test_edit_CTRL_EY() +func Test_edit_CTRL_EY() " Ctrl-E/ Ctrl-Y in insert mode completion to scroll 10new call setline(1, range(1, 100)) @@ -517,7 +517,7 @@ func! Test_edit_CTRL_EY() bw! endfunc -func! Test_edit_CTRL_G() +func Test_edit_CTRL_G() new call setline(1, ['foobar', 'foobar', 'foobar']) call cursor(2, 4) @@ -535,7 +535,7 @@ func! Test_edit_CTRL_G() bw! endfunc -func! Test_edit_CTRL_I() +func Test_edit_CTRL_I() " Tab in completion mode let path=expand("%:p:h") new @@ -559,7 +559,7 @@ func! Test_edit_CTRL_I() bw! endfunc -func! Test_edit_CTRL_K() +func Test_edit_CTRL_K() " Test pressing CTRL-K (basically only dictionary completion and digraphs " the rest is already covered call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt') @@ -632,7 +632,7 @@ func! Test_edit_CTRL_K() bw! endfunc -func! Test_edit_CTRL_L() +func Test_edit_CTRL_L() " Test Ctrl-X Ctrl-L (line completion) new set complete=. @@ -688,7 +688,7 @@ func! Test_edit_CTRL_L() bw! endfunc -func! Test_edit_CTRL_N() +func Test_edit_CTRL_N() " Check keyword completion new set complete=. @@ -709,7 +709,7 @@ func! Test_edit_CTRL_N() bw! endfunc -func! Test_edit_CTRL_O() +func Test_edit_CTRL_O() " Check for CTRL-O in insert mode new inoreabbr h here some more @@ -749,7 +749,7 @@ func! Test_edit_CTRL_R() bw! endfunc -func! Test_edit_CTRL_S() +func Test_edit_CTRL_S() " Test pressing CTRL-S (basically only spellfile completion) " the rest is already covered new @@ -793,7 +793,7 @@ func! Test_edit_CTRL_S() bw! endfunc -func! Test_edit_CTRL_T() +func Test_edit_CTRL_T() " Check for CTRL-T and CTRL-X CTRL-T in insert mode " 1) increase indent new @@ -870,7 +870,7 @@ func! Test_edit_CTRL_T() bw! endfunc -func! Test_edit_CTRL_U() +func Test_edit_CTRL_U() " Test 'completefunc' new " -1, -2 and -3 are special return values @@ -929,7 +929,7 @@ func! Test_edit_CTRL_U() bw! endfunc -func! Test_edit_CTRL_Z() +func Test_edit_CTRL_Z() " Ctrl-Z when insertmode is not set inserts it literally new call setline(1, 'abc') @@ -939,7 +939,7 @@ func! Test_edit_CTRL_Z() " TODO: How to Test Ctrl-Z in insert mode, e.g. suspend? endfunc -func! Test_edit_DROP() +func Test_edit_DROP() if !has("dnd") return endif @@ -955,7 +955,7 @@ func! Test_edit_DROP() bw! endfunc -func! Test_edit_CTRL_V() +func Test_edit_CTRL_V() if has("ebcdic") return endif @@ -983,7 +983,7 @@ func! Test_edit_CTRL_V() bw! endfunc -func! Test_edit_F1() +func Test_edit_F1() " Pressing new call feedkeys(":set im\\\", 'tnix') @@ -993,7 +993,7 @@ func! Test_edit_F1() bw endfunc -func! Test_edit_F21() +func Test_edit_F21() " Pressing " sends a netbeans command if has("netbeans_intg") @@ -1004,7 +1004,7 @@ func! Test_edit_F21() endif endfunc -func! Test_edit_HOME_END() +func Test_edit_HOME_END() " Test Home/End Keys new set foldopen+=hor @@ -1019,7 +1019,7 @@ func! Test_edit_HOME_END() bw! endfunc -func! Test_edit_INS() +func Test_edit_INS() " Test for Pressing new call setline(1, ['abc', 'def']) @@ -1033,7 +1033,7 @@ func! Test_edit_INS() bw! endfunc -func! Test_edit_LEFT_RIGHT() +func Test_edit_LEFT_RIGHT() " Left, Shift-Left, Right, Shift-Right new call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX']) @@ -1080,7 +1080,7 @@ func! Test_edit_LEFT_RIGHT() bw! endfunc -func! Test_edit_MOUSE() +func Test_edit_MOUSE() " This is a simple test, since we not really using the mouse here if !has("mouse") return @@ -1135,7 +1135,7 @@ func! Test_edit_MOUSE() bw! endfunc -func! Test_edit_PAGEUP_PAGEDOWN() +func Test_edit_PAGEUP_PAGEDOWN() 10new call setline(1, repeat(['abc def ghi'], 30)) call cursor(1, 1) @@ -1234,7 +1234,7 @@ func! Test_edit_PAGEUP_PAGEDOWN() bw! endfunc -func! Test_edit_forbidden() +func Test_edit_forbidden() new " 1) edit in the sandbox is not allowed call setline(1, 'a') @@ -1294,7 +1294,7 @@ func! Test_edit_forbidden() bw! endfunc -func! Test_edit_rightleft() +func Test_edit_rightleft() " Cursor in rightleft mode moves differently if !exists("+rightleft") return diff --git a/src/nvim/testdir/test_fnameescape.vim b/src/nvim/testdir/test_fnameescape.vim index cdff0dfbd9..5382b89aa6 100644 --- a/src/nvim/testdir/test_fnameescape.vim +++ b/src/nvim/testdir/test_fnameescape.vim @@ -1,6 +1,6 @@ " Test if fnameescape is correct for special chars like ! -function! Test_fnameescape() +func Test_fnameescape() let fname = 'Xspa ce' let status = v:false try @@ -18,4 +18,4 @@ function! Test_fnameescape() endtry call assert_true(status, "ExclamationMark") call delete(fname) -endfunction +endfunc diff --git a/src/nvim/testdir/test_getcwd.vim b/src/nvim/testdir/test_getcwd.vim index 5d97295e9a..ca098781e4 100644 --- a/src/nvim/testdir/test_getcwd.vim +++ b/src/nvim/testdir/test_getcwd.vim @@ -1,112 +1,112 @@ -function! GetCwdInfo(win, tab) - let tab_changed = 0 - let mod = ":t" - if a:tab > 0 && a:tab != tabpagenr() - let tab_changed = 1 - exec "tabnext " . a:tab - endif - let bufname = fnamemodify(bufname(winbufnr(a:win)), mod) - if tab_changed - tabprevious - endif - if a:win == 0 && a:tab == 0 - let dirname = fnamemodify(getcwd(), mod) - let lflag = haslocaldir() - elseif a:tab == 0 - let dirname = fnamemodify(getcwd(a:win), mod) - let lflag = haslocaldir(a:win) - else - let dirname = fnamemodify(getcwd(a:win, a:tab), mod) - let lflag = haslocaldir(a:win, a:tab) - endif - return bufname . ' ' . dirname . ' ' . lflag -endfunction +func GetCwdInfo(win, tab) + let tab_changed = 0 + let mod = ":t" + if a:tab > 0 && a:tab != tabpagenr() + let tab_changed = 1 + exec "tabnext " . a:tab + endif + let bufname = fnamemodify(bufname(winbufnr(a:win)), mod) + if tab_changed + tabprevious + endif + if a:win == 0 && a:tab == 0 + let dirname = fnamemodify(getcwd(), mod) + let lflag = haslocaldir() + elseif a:tab == 0 + let dirname = fnamemodify(getcwd(a:win), mod) + let lflag = haslocaldir(a:win) + else + let dirname = fnamemodify(getcwd(a:win, a:tab), mod) + let lflag = haslocaldir(a:win, a:tab) + endif + return bufname . ' ' . dirname . ' ' . lflag +endfunc " Do all test in a separate window to avoid E211 when we recursively " delete the Xtopdir directory during cleanup function SetUp() - set visualbell - set nocp viminfo+=nviminfo + set visualbell + set nocp viminfo+=nviminfo - " On windows a swapfile in Xtopdir prevents it from being cleaned up. - set noswapfile + " On windows a swapfile in Xtopdir prevents it from being cleaned up. + set noswapfile - " On windows a stale "Xtopdir" directory may exist, remove it so that - " we start from a clean state. - call delete("Xtopdir", "rf") - new - call mkdir('Xtopdir') - cd Xtopdir - let g:topdir = getcwd() - call mkdir('Xdir1') - call mkdir('Xdir2') - call mkdir('Xdir3') + " On windows a stale "Xtopdir" directory may exist, remove it so that + " we start from a clean state. + call delete("Xtopdir", "rf") + new + call mkdir('Xtopdir') + cd Xtopdir + let g:topdir = getcwd() + call mkdir('Xdir1') + call mkdir('Xdir2') + call mkdir('Xdir3') endfunction let g:cwd=getcwd() function TearDown() - q - exec "cd " . g:cwd - call delete("Xtopdir", "rf") + q + exec "cd " . g:cwd + call delete("Xtopdir", "rf") endfunction function Test_GetCwd() - new a - new b - new c - 3wincmd w - lcd Xdir1 - call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - lcd Xdir3 - call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) - call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) - call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) - call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) - call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) - call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) - call assert_equal(g:topdir, getcwd(-1)) + new a + new b + new c + 3wincmd w + lcd Xdir1 + call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir3 + call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) + call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) + call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) + call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) + call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) + call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) + call assert_equal(g:topdir, getcwd(-1)) - tabnew x - new y - new z - 3wincmd w - call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - lcd Xdir2 - call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - lcd Xdir3 - call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) - call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) - call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) - call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) - call assert_equal(g:topdir, getcwd(-1)) - let tp_nr = tabpagenr() - tabrewind - call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) - call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) - call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) - call assert_equal(g:topdir, getcwd(-1)) + tabnew x + new y + new z + 3wincmd w + call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir2 + call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir3 + call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) + call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) + call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) + call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) + call assert_equal(g:topdir, getcwd(-1)) + let tp_nr = tabpagenr() + tabrewind + call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) + call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) + call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) + call assert_equal(g:topdir, getcwd(-1)) endfunc function Test_GetCwd_lcd_shellslash() - new - let root = fnamemodify('/', ':p') - exe 'lcd '.root - let cwd = getcwd() - if !exists('+shellslash') || &shellslash - call assert_equal(cwd[-1:], '/') - else - call assert_equal(cwd[-1:], '\') - endif + new + let root = fnamemodify('/', ':p') + exe 'lcd '.root + let cwd = getcwd() + if !exists('+shellslash') || &shellslash + call assert_equal(cwd[-1:], '/') + else + call assert_equal(cwd[-1:], '\') + endif endfunc diff --git a/src/nvim/testdir/test_highlight.vim b/src/nvim/testdir/test_highlight.vim index a80a73161f..8f6834c2ab 100644 --- a/src/nvim/testdir/test_highlight.vim +++ b/src/nvim/testdir/test_highlight.vim @@ -39,15 +39,15 @@ func Test_highlight() call assert_fails("hi Crash term='asdf", "E475:") endfunc -function! HighlightArgs(name) +func HighlightArgs(name) return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\', '', '') -endfunction +endfunc -function! IsColorable() +func IsColorable() return has('gui_running') || str2nr(&t_Co) >= 8 -endfunction +endfunc -function! HiCursorLine() +func HiCursorLine() let hiCursorLine = HighlightArgs('CursorLine') if has('gui_running') let guibg = matchstr(hiCursorLine, 'guibg=\w\+') @@ -58,9 +58,9 @@ function! HiCursorLine() let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray' endif return [hiCursorLine, hi_ul, hi_bg] -endfunction +endfunc -function! Check_lcs_eol_attrs(attrs, row, col) +func Check_lcs_eol_attrs(attrs, row, col) let save_lcs = &lcs set list @@ -68,7 +68,7 @@ function! Check_lcs_eol_attrs(attrs, row, col) set nolist let &lcs = save_lcs -endfunction +endfunc func Test_highlight_eol_with_cursorline() let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() diff --git a/src/nvim/testdir/test_hlsearch.vim b/src/nvim/testdir/test_hlsearch.vim index 97f6ae7b51..cf2791113a 100644 --- a/src/nvim/testdir/test_hlsearch.vim +++ b/src/nvim/testdir/test_hlsearch.vim @@ -1,6 +1,6 @@ " Test for v:hlsearch -function! Test_hlsearch() +func Test_hlsearch() new call setline(1, repeat(['aaa'], 10)) set hlsearch nolazyredraw @@ -30,7 +30,7 @@ function! Test_hlsearch() call garbagecollect(1) call getchar(1) enew! -endfunction +endfunc func Test_hlsearch_hangs() if !has('reltime') || !has('float') diff --git a/src/nvim/testdir/test_listlbr.vim b/src/nvim/testdir/test_listlbr.vim index cdc5e4cc7c..d619ac0eb5 100644 --- a/src/nvim/testdir/test_listlbr.vim +++ b/src/nvim/testdir/test_listlbr.vim @@ -16,9 +16,9 @@ function s:screen_lines(lnum, width) abort return ScreenLines(a:lnum, a:width) endfunction -function! s:compare_lines(expect, actual) +func s:compare_lines(expect, actual) call assert_equal(join(a:expect, "\n"), join(a:actual, "\n")) -endfunction +endfunc function s:test_windows(...) call NewWindow(10, 20) diff --git a/src/nvim/testdir/test_listlbr_utf8.vim b/src/nvim/testdir/test_listlbr_utf8.vim index b648a3361b..c38e0c5f3c 100644 --- a/src/nvim/testdir/test_listlbr_utf8.vim +++ b/src/nvim/testdir/test_listlbr_utf8.vim @@ -9,15 +9,15 @@ endif source view_util.vim -function s:screen_lines(lnum, width) abort +func s:screen_lines(lnum, width) abort return ScreenLines(a:lnum, a:width) -endfunction +endfunc -function! s:compare_lines(expect, actual) +func s:compare_lines(expect, actual) call assert_equal(a:expect, a:actual) -endfunction +endfunc -function s:screen_attr(lnum, chars, ...) abort +func s:screen_attr(lnum, chars, ...) abort let line = getline(a:lnum) let attr = [] let prefix = get(a:000, 0, 0) @@ -26,18 +26,18 @@ function s:screen_attr(lnum, chars, ...) abort let attr += [screenattr(a:lnum, scol + prefix)] endfor return attr -endfunction +endfunc -function s:test_windows(...) +func s:test_windows(...) call NewWindow(10, 20) setl ts=4 sw=4 sts=4 linebreak sbr=+ wrap exe get(a:000, 0, '') -endfunction +endfunc -function s:close_windows(...) +func s:close_windows(...) call CloseWindow() exe get(a:000, 0, '') -endfunction +endfunc func Test_linebreak_with_fancy_listchars() call s:test_windows("setl list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6") diff --git a/src/nvim/testdir/test_matchadd_conceal.vim b/src/nvim/testdir/test_matchadd_conceal.vim index 393e183ddb..f9e40a9b43 100644 --- a/src/nvim/testdir/test_matchadd_conceal.vim +++ b/src/nvim/testdir/test_matchadd_conceal.vim @@ -27,9 +27,9 @@ function! Test_simple_matchadd() call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) quit! -endfunction +endfunc -function! Test_simple_matchadd_and_conceal() +func Test_simple_matchadd_and_conceal() new setlocal concealcursor=n conceallevel=1 @@ -49,9 +49,9 @@ function! Test_simple_matchadd_and_conceal() call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) quit! -endfunction +endfunc -function! Test_matchadd_and_conceallevel_3() +func Test_matchadd_and_conceallevel_3() new setlocal conceallevel=3 @@ -90,9 +90,9 @@ function! Test_matchadd_and_conceallevel_3() syntax off quit! -endfunction +endfunc -function! Test_default_conceal_char() +func Test_default_conceal_char() new setlocal concealcursor=n conceallevel=1 @@ -126,9 +126,9 @@ function! Test_default_conceal_char() let &listchars = listchars_save quit! -endfunction +endfunc -function! Test_syn_and_match_conceal() +func Test_syn_and_match_conceal() new setlocal concealcursor=n conceallevel=1 @@ -162,9 +162,9 @@ function! Test_syn_and_match_conceal() syntax off quit! -endfunction +endfunc -function! Test_clearmatches() +func Test_clearmatches() new setlocal concealcursor=n conceallevel=1 @@ -201,9 +201,9 @@ function! Test_clearmatches() call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0]) quit! -endfunction +endfunc -function! Test_using_matchaddpos() +func Test_using_matchaddpos() new setlocal concealcursor=n conceallevel=1 " set filetype and :syntax on to change screenattr() @@ -232,9 +232,9 @@ function! Test_using_matchaddpos() syntax off quit! -endfunction +endfunc -function! Test_matchadd_repeat_conceal_with_syntax_off() +func Test_matchadd_repeat_conceal_with_syntax_off() new " To test targets in the same line string is replaced with conceal char @@ -251,9 +251,9 @@ function! Test_matchadd_repeat_conceal_with_syntax_off() call assert_equal('t_tt', Screenline(2)) quit! -endfunction +endfunc -function! Test_matchadd_and_syn_conceal() +func Test_matchadd_and_syn_conceal() new let cnt='Inductive bool : Type := | true : bool | false : bool.' let expect = 'Inductive - : Type := | true : - | false : -.' diff --git a/src/nvim/testdir/test_matchadd_conceal_utf8.vim b/src/nvim/testdir/test_matchadd_conceal_utf8.vim index 160d0598a1..34c8c49dd5 100644 --- a/src/nvim/testdir/test_matchadd_conceal_utf8.vim +++ b/src/nvim/testdir/test_matchadd_conceal_utf8.vim @@ -36,4 +36,4 @@ function! Test_match_using_multibyte_conceal_char() call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) quit! -endfunction +endfunc diff --git a/src/nvim/testdir/test_number.vim b/src/nvim/testdir/test_number.vim index 3c9afc41d5..81326bce14 100644 --- a/src/nvim/testdir/test_number.vim +++ b/src/nvim/testdir/test_number.vim @@ -2,23 +2,23 @@ source view_util.vim -func! s:screen_lines(start, end) abort +func s:screen_lines(start, end) abort return ScreenLines([a:start, a:end], 8) endfunc -func! s:compare_lines(expect, actual) +func s:compare_lines(expect, actual) call assert_equal(a:expect, a:actual) endfunc -func! s:test_windows(h, w) abort +func s:test_windows(h, w) abort call NewWindow(a:h, a:w) endfunc -func! s:close_windows() abort +func s:close_windows() abort call CloseWindow() endfunc -func! s:validate_cursor() abort +func s:validate_cursor() abort " update skipcol. " wincol(): " f_wincol diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 10e16f4198..15c1836c9a 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -1,6 +1,6 @@ " Test for options -function! Test_whichwrap() +func Test_whichwrap() set whichwrap=b,s call assert_equal('b,s', &whichwrap) diff --git a/src/nvim/testdir/test_partial.vim b/src/nvim/testdir/test_partial.vim index 590e18e024..52aac05ea1 100644 --- a/src/nvim/testdir/test_partial.vim +++ b/src/nvim/testdir/test_partial.vim @@ -113,9 +113,9 @@ func Test_function_in_dict() call OuterCall() endfunc -function! s:cache_clear() dict +func s:cache_clear() dict return self.name -endfunction +endfunc func Test_script_function_in_dict() let s:obj = {'name': 'foo'} @@ -135,10 +135,10 @@ func Test_script_function_in_dict() call assert_equal('bar', B()) endfunc -function! s:cache_arg(arg) dict +func s:cache_arg(arg) dict let s:result = self.name . '/' . a:arg return s:result -endfunction +endfunc func Test_script_function_in_dict_arg() let s:obj = {'name': 'foo'} diff --git a/src/nvim/testdir/test_smartindent.vim b/src/nvim/testdir/test_smartindent.vim index 9e93a55eb0..e89ad19d34 100644 --- a/src/nvim/testdir/test_smartindent.vim +++ b/src/nvim/testdir/test_smartindent.vim @@ -1,24 +1,24 @@ " Tests for smartindent " Tests for not doing smart indenting when it isn't set. -function! Test_nosmartindent() +func Test_nosmartindent() new call append(0, [" some test text", - \ " test text", - \ "test text", - \ " test text"]) + \ " test text", + \ "test text", + \ " test text"]) set nocindent nosmartindent autoindent exe "normal! gg/some\" exe "normal! 2cc#test\" call assert_equal(" #test", getline(1)) enew! | close -endfunction +endfunc -function MyIndent() -endfunction +func MyIndent() +endfunc " When 'indentexpr' is set, setting 'si' has no effect. -function Test_smartindent_has_no_effect() +func Test_smartindent_has_no_effect() new exe "normal! i\one\" set noautoindent @@ -36,6 +36,6 @@ function Test_smartindent_has_no_effect() set smartindent& set indentexpr& bwipe! -endfunction +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index ff07d8eceb..2a27f7a3a1 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -1,6 +1,6 @@ " Tests for multi-line regexps with ":s". -function! Test_multiline_subst() +func Test_multiline_subst() enew! call append(0, ["1 aa", \ "bb", @@ -38,9 +38,9 @@ function! Test_multiline_subst() call assert_equal('7x7f', getline(12)) call assert_equal('xxxxx', getline(13)) enew! -endfunction +endfunc -function! Test_substitute_variants() +func Test_substitute_variants() " Validate that all the 2-/3-letter variants which embed the flags into the " command name actually work. enew! @@ -248,9 +248,9 @@ func Test_sub_cmd_4() " List entry format: [input, cmd, output] let tests = [ ['aAa', "s/A/\\=substitute(submatch(0), '.', '\\', '')/", - \ ['a\a']], + \ ['a\a']], \ ['bBb', "s/B/\\=substitute(submatch(0), '.', '\\', '')/", - \ ['b\b']], + \ ['b\b']], \ ['cCc', "s/C/\\=substitute(submatch(0), '.', '\\', '')/", \ ["c\", 'c']], \ ['dDd', "s/D/\\=substitute(submatch(0), '.', '\\\\', '')/", diff --git a/src/nvim/testdir/test_textobjects.vim b/src/nvim/testdir/test_textobjects.vim index f70cc1f70a..9b800d0fa9 100644 --- a/src/nvim/testdir/test_textobjects.vim +++ b/src/nvim/testdir/test_textobjects.vim @@ -301,7 +301,7 @@ func Test_sentence_with_quotes() %delete _ endfunc -func! Test_sentence_with_cursor_on_delimiter() +func Test_sentence_with_cursor_on_delimiter() enew! call setline(1, "A '([sentence.])' A sentence.") diff --git a/src/nvim/testdir/test_utf8.vim b/src/nvim/testdir/test_utf8.vim index 1b4ce4c4af..8302ccb67f 100644 --- a/src/nvim/testdir/test_utf8.vim +++ b/src/nvim/testdir/test_utf8.vim @@ -22,17 +22,17 @@ func Test_strchars() endfunc " Test for customlist completion -function! CustomComplete1(lead, line, pos) +func CustomComplete1(lead, line, pos) return ['あ', 'い'] -endfunction +endfunc -function! CustomComplete2(lead, line, pos) +func CustomComplete2(lead, line, pos) return ['あたし', 'あたま', 'あたりめ'] -endfunction +endfunc -function! CustomComplete3(lead, line, pos) +func CustomComplete3(lead, line, pos) return ['Nこ', 'Nん', 'Nぶ'] -endfunction +endfunc func Test_customlist_completion() command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo diff --git a/src/nvim/testdir/test_utf8_comparisons.vim b/src/nvim/testdir/test_utf8_comparisons.vim index 1fc670aafd..fdf9d80802 100644 --- a/src/nvim/testdir/test_utf8_comparisons.vim +++ b/src/nvim/testdir/test_utf8_comparisons.vim @@ -29,26 +29,26 @@ function! Chk(a, b, result) call Ch(a:a, '?', a:b, 0) endif -endfunction +endfunc -function! Check(a, b, result) +func Check(a, b, result) call Chk(a:a, a:b, a:result) call Chk(a:b, a:a, -a:result) -endfunction +endfunc -function! LT(a, b) +func LT(a, b) call Check(a:a, a:b, -1) -endfunction +endfunc -function! GT(a, b) +func GT(a, b) call Check(a:a, a:b, 1) -endfunction +endfunc -function! EQ(a, b) +func EQ(a, b) call Check(a:a, a:b, 0) -endfunction +endfunc -function Test_comparisons() +func Test_comparisons() call EQ('', '') call LT('', 'a') call EQ('abc', 'abc') @@ -81,11 +81,11 @@ function Test_comparisons() for n in range(0xC0, 0xFF) call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) endfor -endfunction +endfunc " test that g~ap changes one paragraph only. -function Test_gap() +func Test_gap() new call feedkeys("iabcd\n\ndefggg0g~ap", "tx") call assert_equal(["ABCD", "", "defg"], getline(1,3)) -endfunction +endfunc diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index 118a5dab2b..072c3d28e7 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -5,11 +5,11 @@ " Test environment {{{1 "------------------------------------------------------------------------------- -com! XpathINIT let g:Xpath = '' +com! XpathINIT let g:Xpath = '' com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . " Append a message to the "messages" file -func! Xout(text) +func Xout(text) split messages $put =a:text wq @@ -50,7 +50,7 @@ function! MakeScript(funcname, ...) write bwipeout return script -endfunction +endfunc " ExecAsScript - Source a temporary script made from a function. {{{2 " @@ -301,9 +301,9 @@ XpathINIT " let calls = "" com! -nargs=1 CALL - \ if !exists("calls") && !exists("outer") | - \ let g:calls = g:calls . | - \ endif + \ if !exists("calls") && !exists("outer") | + \ let g:calls = g:calls . | + \ endif let i = 0 while i < 3 @@ -357,7 +357,7 @@ endif if exists("*F1") call F1("F1") if exists("*G1") - call G1("G1") + call G1("G1") endif endif @@ -367,13 +367,13 @@ endif if exists("*F2") call F2(2, "F2") if exists("*G21") - call G21("G21") + call G21("G21") endif if exists("*G22") - call G22("G22") + call G22("G22") endif if exists("*G23") - call G23("G23") + call G23("G23") endif endif @@ -383,13 +383,13 @@ endif if exists("*F3") call F3(3, "F3") if exists("*G31") - call G31("G31") + call G31("G31") endif if exists("*G32") - call G32("G32") + call G32("G32") endif if exists("*G33") - call G33("G33") + call G33("G33") endif endif @@ -640,7 +640,7 @@ function! MSG(enr, emsg) endif endif return match -endfunction +endfunc if 1 || strlen("\"") | Xpath 'a' Xpath 'b' @@ -1099,70 +1099,70 @@ endfunction func Test_script_lines() " :append try - call DefineFunction('T_Append', [ - \ 'append', - \ 'py < Date: Mon, 30 Nov 2020 01:11:22 -0500 Subject: [PATCH 3/4] test/old: partial port of patch 8.1.0736 Required for patch 8.1.2264. --- src/nvim/testdir/test49.vim | 4 ++-- src/nvim/testdir/test_assign.vim | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/nvim/testdir/test49.vim b/src/nvim/testdir/test49.vim index 103b282bc7..5468f7c4aa 100644 --- a/src/nvim/testdir/test49.vim +++ b/src/nvim/testdir/test49.vim @@ -3694,7 +3694,7 @@ endif if ExtraVim(msgfile) try Xpath 4194304 " X: 4194304 - let x = novar " error E121/E15; exception: E121 + let x = novar " error E121; exception: E121 catch /E15:/ " should not catch Xpath 8388608 " X: 0 endtry @@ -3702,7 +3702,7 @@ if ExtraVim(msgfile) endif Xpath 33554432 " X: 33554432 -if !MESSAGES('E121', "Undefined variable", 'E15', "Invalid expression") +if !MESSAGES('E121', "Undefined variable") Xpath 67108864 " X: 0 endif diff --git a/src/nvim/testdir/test_assign.vim b/src/nvim/testdir/test_assign.vim index 50415ad6fd..542b8469b7 100644 --- a/src/nvim/testdir/test_assign.vim +++ b/src/nvim/testdir/test_assign.vim @@ -25,11 +25,11 @@ func Test_let_termcap() let &t_k1 = old_t_k1 endif - call assert_fails('let x = &t_xx', 'E15') + call assert_fails('let x = &t_xx', 'E113') let &t_xx = "yes" call assert_equal("yes", &t_xx) let &t_xx = "" - call assert_fails('let x = &t_xx', 'E15') + call assert_fails('let x = &t_xx', 'E113') endfunc func Test_let_option_error() @@ -45,3 +45,11 @@ func Test_let_option_error() call assert_equal("vert:|", &fillchars) let &fillchars = _w endfunc + +func Test_let_errors() + let s = 'abcd' + call assert_fails('let s[1] = 5', 'E689:') + + let l = [1, 2, 3] + call assert_fails('let l[:] = 5', 'E709:') +endfunc From 87279bb8099fb0c37667ae131d4f7dbeb42dc504 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 30 Nov 2020 01:12:34 -0500 Subject: [PATCH 4/4] vim-patch:8.1.2264: there are two test files for :let Problem: There are two test files for :let. Solution: Merge the two files. https://github.com/vim/vim/commit/fcf8a8743bdecc0ba28037b79b7cb2962de70b1d N/A patches for version.c: vim-patch:8.2.0617: new error check triggers in Swedish menu Problem: New error check triggers in Swedish menu. Solution: Insert backslash. (Mats Tegner, closes vim/vim#5966) https://github.com/vim/vim/commit/d2662ad2de40e68999198150024531c91fece16c vim-patch:8.2.0620: error in menu translations Problem: Error in menu translations. Solution: Insert a backslash before a space. https://github.com/vim/vim/commit/0d6fe631f75effbfca92a4f61bbc2fab7385af09 vim-patch:8.2.0628: error in menu translations Problem: Error in menu translations. Solution: Insert a backslash before a space in one more file. (Shun Bai, Emir Sari) https://github.com/vim/vim/commit/e71ebb46a252cd1cdfb075e6014c2b13c580bf3f --- src/nvim/testdir/test_alot.vim | 1 - src/nvim/testdir/test_assign.vim | 55 -------------------------------- src/nvim/testdir/test_let.vim | 53 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 56 deletions(-) delete mode 100644 src/nvim/testdir/test_assign.vim diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 7647475427..4f056abdc0 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -1,7 +1,6 @@ " A series of tests that can run in one Vim invocation. " This makes testing go faster, since Vim doesn't need to restart. -source test_assign.vim source test_backup.vim source test_behave.vim source test_cd.vim diff --git a/src/nvim/testdir/test_assign.vim b/src/nvim/testdir/test_assign.vim deleted file mode 100644 index 542b8469b7..0000000000 --- a/src/nvim/testdir/test_assign.vim +++ /dev/null @@ -1,55 +0,0 @@ -" Test for assignment - -func Test_no_type_checking() - let v = 1 - let v = [1,2,3] - let v = {'a': 1, 'b': 2} - let v = 3.4 - let v = 'hello' -endfunc - -func Test_let_termcap() - " Nvim does not support `:set termcap`. - return - " Terminal code - let old_t_te = &t_te - let &t_te = "\[yes;" - call assert_match('t_te.*^[[yes;', execute("set termcap")) - let &t_te = old_t_te - - if exists("+t_k1") - " Key code - let old_t_k1 = &t_k1 - let &t_k1 = "that" - call assert_match('t_k1.*that', execute("set termcap")) - let &t_k1 = old_t_k1 - endif - - call assert_fails('let x = &t_xx', 'E113') - let &t_xx = "yes" - call assert_equal("yes", &t_xx) - let &t_xx = "" - call assert_fails('let x = &t_xx', 'E113') -endfunc - -func Test_let_option_error() - let _w = &tw - let &tw = 80 - call assert_fails('let &tw .= 1', 'E734') - call assert_equal(80, &tw) - let &tw = _w - - let _w = &fillchars - let &fillchars = "vert:|" - call assert_fails('let &fillchars += "diff:-"', 'E734') - call assert_equal("vert:|", &fillchars) - let &fillchars = _w -endfunc - -func Test_let_errors() - let s = 'abcd' - call assert_fails('let s[1] = 5', 'E689:') - - let l = [1, 2, 3] - call assert_fails('let l[:] = 5', 'E709:') -endfunc diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim index 0b9331ee38..a5cbd8f6a6 100644 --- a/src/nvim/testdir/test_let.vim +++ b/src/nvim/testdir/test_let.vim @@ -150,6 +150,59 @@ func Test_let_utf8_environment() call assert_equal('ĀĒĪŌŪあいうえお', $a) endfunc +func Test_let_no_type_checking() + let v = 1 + let v = [1,2,3] + let v = {'a': 1, 'b': 2} + let v = 3.4 + let v = 'hello' +endfunc + +func Test_let_termcap() + throw 'skipped: Nvim does not support termcap option' + " Terminal code + let old_t_te = &t_te + let &t_te = "\[yes;" + call assert_match('t_te.*^[[yes;', execute("set termcap")) + let &t_te = old_t_te + + if exists("+t_k1") + " Key code + let old_t_k1 = &t_k1 + let &t_k1 = "that" + call assert_match('t_k1.*that', execute("set termcap")) + let &t_k1 = old_t_k1 + endif + + call assert_fails('let x = &t_xx', 'E113') + let &t_xx = "yes" + call assert_equal("yes", &t_xx) + let &t_xx = "" + call assert_fails('let x = &t_xx', 'E113') +endfunc + +func Test_let_option_error() + let _w = &tw + let &tw = 80 + call assert_fails('let &tw .= 1', 'E734') + call assert_equal(80, &tw) + let &tw = _w + + let _w = &fillchars + let &fillchars = "vert:|" + call assert_fails('let &fillchars += "diff:-"', 'E734') + call assert_equal("vert:|", &fillchars) + let &fillchars = _w +endfunc + +func Test_let_errors() + let s = 'abcd' + call assert_fails('let s[1] = 5', 'E689:') + + let l = [1, 2, 3] + call assert_fails('let l[:] = 5', 'E709:') +endfunc + func Test_let_heredoc_fails() call assert_fails('let v =<< marker', 'E991:')